From patchwork Fri Jan 27 17:03:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 13119058 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8707DC38142 for ; Fri, 27 Jan 2023 17:05:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233721AbjA0RFR (ORCPT ); Fri, 27 Jan 2023 12:05:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231547AbjA0RFQ (ORCPT ); Fri, 27 Jan 2023 12:05:16 -0500 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2060d.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe5a::60d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E29A84B68; Fri, 27 Jan 2023 09:04:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ieisQBa9MuN9u9e0X1+WM/D0d3DyX32gyNymSuT0/3fxSLTB0Uwie2xYtOMUOSVqK8gqB8Gk/QY2spUfNLBWah7OsKaJRoVD01ZXpXb8YSi4/AaSnM2YdIGPaU3x+7Cfm1FieinFkznnd/VFvlEXyTMRs+V2pemgwGc3ihA+MF82gP2G3dOPYgamQ3bPhijSuwO3cXDCCwGkZRaw5qLu2dHOBmeN/Rw1SjiuUpIJ433BWWGky1jbQOTwTP8/AB+KRu83A5bHB7rc65sf1D48w3TRzbBtIaeCKmKBHPRUxtkd88gnDv6JwGW5gI8QSSS2NxovjCzLdEBnMzkHZGDWNQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=D6Rx5/VLRGVhr43ZfQpk8+vFs/yVdqMjfvHz9iJaGCc=; b=nb2/XLVxQWzY5AgTPZsjzW6G6IUhiDw4o31XQ0P41gvxBpUpwBGDuY5QjvTxQol6fQWcnUOP011e7cRPilXvUbirOTm5WsQ8JrgZPN9GuOh+oVhSUZdKZHDJoO/BAIfz2OVqDiqcFH4J+Z2MlDfEftuq2xaXuxv25F3twRHN45eLSI3Kgyz3IILpQfymIqIMo+HClR1XQsY4S3FhBVEIzYTNO/xTWQmx5pRXfV59IdFbEKjRo8faGRCuZZ+NYVCb6vrgMB6qII3YH006q4dfNaElMcNE6eecTzp2M38g6Yo1MxhA6w7pYRh/9M0yRRqrDclt5z9m5FzNWgb3aDyxsQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=D6Rx5/VLRGVhr43ZfQpk8+vFs/yVdqMjfvHz9iJaGCc=; b=Ki7nDaaUb9QbrqvxtmQTVr+GeecVp+ddsruvNAf2fv4g7bQ8lHycjTE/sMbBN5OzXQyJKv2nBAW76hoWAbljBNCsSMfdF20niv9ruG8YMF3Q1+GsuComlyoK1UykpCIwuw/iO/IJa53vYzu89QzKABolvjr3mq9tjohA9d64R2o= Received: from BN8PR04CA0047.namprd04.prod.outlook.com (2603:10b6:408:d4::21) by MN0PR12MB6103.namprd12.prod.outlook.com (2603:10b6:208:3c9::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.22; Fri, 27 Jan 2023 17:04:32 +0000 Received: from BN8NAM11FT089.eop-nam11.prod.protection.outlook.com (2603:10b6:408:d4:cafe::e8) by BN8PR04CA0047.outlook.office365.com (2603:10b6:408:d4::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.22 via Frontend Transport; Fri, 27 Jan 2023 17:04:32 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT089.mail.protection.outlook.com (10.13.176.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6023.16 via Frontend Transport; Fri, 27 Jan 2023 17:04:32 +0000 Received: from yaz-ethanolx.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 27 Jan 2023 11:04:30 -0600 From: Yazen Ghannam To: , CC: , , , Yazen Ghannam Subject: [PATCH v2 01/22] EDAC/amd64: Don't set up EDAC PCI control on Family 17h+ Date: Fri, 27 Jan 2023 17:03:58 +0000 Message-ID: <20230127170419.1824692-2-yazen.ghannam@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230127170419.1824692-1-yazen.ghannam@amd.com> References: <20230127170419.1824692-1-yazen.ghannam@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT089:EE_|MN0PR12MB6103:EE_ X-MS-Office365-Filtering-Correlation-Id: efb76abf-be8f-45b2-a034-08db00888f43 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: F/oK0NRvlA+kT27RN3AwCdApPIPnOPAQ98FDMtHZFv00VmrV6xP2ZFwEtK9dFq5ikgsEXA716XWj4RJ4qYtUNEu7LsoItM7d7el+u3suvwnfIfNs1QGt8Vgi5lSuNl1/5/HXwQex3gsxAXe17D9VN2sFgpQATiAeYT+kN/dHWjseORJVqQIuUSd51njUiOHo7CT+n9HS8fzOZZIJwdpHUoYgW1A/eCkkL/YkwDnppqwz3j3k85zq7IpzEKyI/OO9RP5F5OgXSHNDjfUZkj0laS7uDrPIvHfCrVLMVv1bcev1NIPY1kwtTomcBWkYhaENcSLc9n+OAFHG9v4pEN1WMk4oahR36FBdXGS4fp4xRRThlROor7WEv95tiHE8qP8HIXTkoeS1n3jcjxfxNTHvrqJeKkYMUx88HETTUKxaFXvywVgRe7HcFAecmCBy/6PCk689rReKuMWpuO4FwIziFyS60Csq78/zBgkTJ9Q+YEll285MvEsULvx4g236HEHYGCrx+5Z0MX8Qu5uFej7loEOTRCHBv9XNQGEjV2Ia+sv3wYstiHH2tcIA6sz0hJibVb7lzmxnRx/TmQfnI6cA3XxkkS5HeWGgXQLl9efdQVKfG2sleCioosBT9NvC58Fp49OsJ12jCxTfMIQeoqcoBw7aQUzzY/1R8Z11t8FlWt2G1yawPLA8phHqNyFqhyCanGom1KrbopsJN43zR9j2+cu5Nd9tL+gpPkfS5X+s/otH2N0lWgWGLwEBceJxEgg4N3n/KtxBDBsvNKmUn1p7hA== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230025)(4636009)(376002)(346002)(136003)(396003)(39860400002)(451199018)(46966006)(36840700001)(40470700004)(6666004)(356005)(110136005)(54906003)(41300700001)(81166007)(70206006)(8676002)(70586007)(40480700001)(4326008)(86362001)(40460700003)(36756003)(44832011)(8936002)(5660300002)(36860700001)(2906002)(1076003)(316002)(82740400003)(16526019)(26005)(966005)(186003)(7696005)(478600001)(426003)(83380400001)(82310400005)(47076005)(336012)(2616005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2023 17:04:32.1714 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: efb76abf-be8f-45b2-a034-08db00888f43 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT089.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB6103 Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org EDAC PCI control is used to detect/report legacy PCI errors like "Parity" and "SERROR". Modern AMD systems use PCIe Advanced Error Reporting (AER), and legacy PCI errors should not be reported. Remove EDAC PCI control setup on AMD Family 17h and later systems. Signed-off-by: Yazen Ghannam --- Link: https://lore.kernel.org/r/20220509145534.44912-2-yazen.ghannam@amd.com v1->v2: * No change drivers/edac/amd64_edac.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index e3318e5575a3..2cc7336a5121 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -4370,12 +4370,12 @@ static int __init amd64_edac_init(void) } /* register stuff with EDAC MCE */ - if (boot_cpu_data.x86 >= 0x17) + if (boot_cpu_data.x86 >= 0x17) { amd_register_ecc_decoder(decode_umc_error); - else + } else { amd_register_ecc_decoder(decode_bus_error); - - setup_pci_device(); + setup_pci_device(); + } #ifdef CONFIG_X86_32 amd64_err("%s on 32-bit is unsupported. USE AT YOUR OWN RISK!\n", EDAC_MOD_STR); From patchwork Fri Jan 27 17:03:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 13119080 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7250AC38142 for ; Fri, 27 Jan 2023 17:11:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229889AbjA0RL3 (ORCPT ); Fri, 27 Jan 2023 12:11:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234253AbjA0RL1 (ORCPT ); Fri, 27 Jan 2023 12:11:27 -0500 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on20624.outbound.protection.outlook.com [IPv6:2a01:111:f400:7eb2::624]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92B0C21295; Fri, 27 Jan 2023 09:11:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ILFfJ+1V8Ed25r/2GpX27+ezdXw5tdE4og4EIKGTWElS1NAKKJb+eaE+AOOfl+5vcrkhrbsVtYrV3NLUFsHImvht77FpK0Ht29yfWOByQ8ohrwYbRKOaDycPrIoGm/VMp7IhObVdNJB1sxCp0tsY40E/kcKb/Nf3Rk8Ns/BwC9v4lPItjFQGGZ7Y5NcdLq3MBeqKDnmM3042iUjNxHBWny5sWbwX9EunaNDyFq15Y+3G77X87ReUfvDvTPdPiXtlCcXDNpVLPjR4MpY5a/6ui5hdgqPQ49PBmiOthJwRD+peiO5Jf3/Ddwpu4Lgvyjn9vZvih0adObUVX7jAVbkEbw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=uBX/FwYDzvnwStj27DAwDVed777YXzgRY2WCVOxy7Io=; b=XOWo7NqlAXKNOYDOwNMBdMJ+f5Yj1wyMEeETn0pdk6nAjRABw3j3oTrV7qjtK1OxxWqP0QSN4vVP3Fi6aJ3PZG746gHazwlHchZgeS/I19qHmJf+5U4zOpYwA7zdFaly8PF8ROaVXcgCwlhM4gmw2/hhye8XKX8W88D158zkIQsn+WB6jGzshK83+D+fCI0Tfb+8x3JcMnP5MlVWhhOhkDzpAOlA2VHRGQnQRqmixjyl2n3RS+uOOCKwJesFW/L7SWxSII1jNf+klp8phGNsy3E9h+a3MA8ygMKJhnuEDwepuELABc8JnsZ3fykPVngesT6aDoDicDfc2tgHf5Rw4g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uBX/FwYDzvnwStj27DAwDVed777YXzgRY2WCVOxy7Io=; b=OEc7bJ2FmntaLmPnXvQP2Nng/HA0XY2BdcO1NILkDFYt/lBNae2lUO9N5ZvEBgF6pk+Wp/MEFqDJIMzKQej+XZqtVCNFjF0jQ4VZoLTvh5uVqV6o5NZbSdRx66mPREJVKh863JClgxU0keVnWkRfAYEsalBfGzvrMEqThe1TCYY= Received: from BN8PR04CA0060.namprd04.prod.outlook.com (2603:10b6:408:d4::34) by SN7PR12MB7203.namprd12.prod.outlook.com (2603:10b6:806:2aa::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.25; Fri, 27 Jan 2023 17:04:32 +0000 Received: from BN8NAM11FT089.eop-nam11.prod.protection.outlook.com (2603:10b6:408:d4:cafe::18) by BN8PR04CA0060.outlook.office365.com (2603:10b6:408:d4::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.22 via Frontend Transport; Fri, 27 Jan 2023 17:04:32 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT089.mail.protection.outlook.com (10.13.176.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6023.16 via Frontend Transport; Fri, 27 Jan 2023 17:04:32 +0000 Received: from yaz-ethanolx.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 27 Jan 2023 11:04:31 -0600 From: Yazen Ghannam To: , CC: , , , Yazen Ghannam Subject: [PATCH v2 02/22] EDAC/amd64: Remove scrub rate control for Family 17h and later Date: Fri, 27 Jan 2023 17:03:59 +0000 Message-ID: <20230127170419.1824692-3-yazen.ghannam@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230127170419.1824692-1-yazen.ghannam@amd.com> References: <20230127170419.1824692-1-yazen.ghannam@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT089:EE_|SN7PR12MB7203:EE_ X-MS-Office365-Filtering-Correlation-Id: 486ea70d-4863-4506-12cb-08db00888f78 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PPsEfFFuY9KFvZJUDE8gE2CiSwjjKjXlBmw6Nn0QLdSQVqopJ46BiR3azMGrPtyEt3+qRvr6G4JU0JK8gtyGMnfpPZcfjoBYp0VEVu6Bs2RuTIVsgBB+f94Icm6HvmlYZX4wUhz6vyTX72L38TiW6W6hhDGfvMcrgF0T8qyxOAiRoY9DF1EJuiajoNaxnR7sTQm8CM/uyTzp/kKPsC3+YGrZ3+W5Z84yb5DtZs6dn+5TxEidf94oPFyKDJgsUnvcIIFTYXIdakkY7fxBEKHKlDKdgHH8XDE+/U2HPgGrZ3ZyW666UOhe2ChD2UegjvYtbpMiAOeXwFy5AZjM+4pqqXctqhqny7luQvxxcqD4tIDBmGXQvzeqY67KTEB97Xs0okZSZYOnexWgww/6w/EQ9OckeqBEQNwYguaemCnfAw5lDE4QjkA4afQl5Obt+oAAvXiA5ZCdsXY1RdRLWjSfyxKc0o1oFUgymnrE/wamZzCXDrFJUW/smRCY68xiG5Q43pn9NSVVyrBEJ3KBWR6zYqtGyIibF4UO8157yLA3BnuHeBttAtBckE5mS4Ve6Xv/KJIasgrO8q8UnwB1pTB97fP8xF5XN/oXofkibRGe2cqjSybnvoZj6Zls8YqS4tBK6nxoEWwUT9WdhNqZ/pg8YwtDvj9RSngNyPP5z7ada2Ev4y+VrmuV19V0ZLjmjY2pzaD99vYbZBaqsvGDtgsHX6mAmbKuZxAnp0xVi0NiVGCJpuY+TMb46a9rtcqV9SV7B0wwxNBnJaZFmcaMPVHDlg== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230025)(4636009)(346002)(396003)(39860400002)(136003)(376002)(451199018)(46966006)(36840700001)(40470700004)(26005)(2616005)(4326008)(8676002)(70206006)(336012)(70586007)(7696005)(426003)(186003)(16526019)(47076005)(36756003)(82310400005)(2906002)(86362001)(83380400001)(8936002)(36860700001)(478600001)(40480700001)(966005)(54906003)(316002)(110136005)(1076003)(40460700003)(6666004)(41300700001)(82740400003)(5660300002)(81166007)(44832011)(356005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2023 17:04:32.5151 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 486ea70d-4863-4506-12cb-08db00888f78 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT089.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7203 Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org The scrub registers on AMD Family 17h and later may be inaccessible to the OS. Furthermore, hardware designers recommend that the scrubbing feature is managed by the firmware. Remove support for the sdram_scrub_rate interface for AMD Family 17h systems and later by not setting the scrub function pointers. The EDAC MC core will then not expose the scrub files in sysfs. Signed-off-by: Yazen Ghannam --- Link: https://lore.kernel.org/r/20220509145534.44912-3-yazen.ghannam@amd.com v1->v2: * Don't set the scrub function pointers. drivers/edac/amd64_edac.c | 33 +++++---------------------------- drivers/edac/amd64_edac.h | 2 -- 2 files changed, 5 insertions(+), 30 deletions(-) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 2cc7336a5121..07a89df0d4f4 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -182,21 +182,6 @@ static inline int amd64_read_dct_pci_cfg(struct amd64_pvt *pvt, u8 dct, * other archs, we might not have access to the caches directly. */ -static inline void __f17h_set_scrubval(struct amd64_pvt *pvt, u32 scrubval) -{ - /* - * Fam17h supports scrub values between 0x5 and 0x14. Also, the values - * are shifted down by 0x5, so scrubval 0x5 is written to the register - * as 0x0, scrubval 0x6 as 0x1, etc. - */ - if (scrubval >= 0x5 && scrubval <= 0x14) { - scrubval -= 0x5; - pci_write_bits32(pvt->F6, F17H_SCR_LIMIT_ADDR, scrubval, 0xF); - pci_write_bits32(pvt->F6, F17H_SCR_BASE_ADDR, 1, 0x1); - } else { - pci_write_bits32(pvt->F6, F17H_SCR_BASE_ADDR, 0, 0x1); - } -} /* * Scan the scrub rate mapping table for a close or matching bandwidth value to * issue. If requested is too big, then use last maximum value found. @@ -229,9 +214,7 @@ static int __set_scrub_rate(struct amd64_pvt *pvt, u32 new_bw, u32 min_rate) scrubval = scrubrates[i].scrubval; - if (pvt->umc) { - __f17h_set_scrubval(pvt, scrubval); - } else if (pvt->fam == 0x15 && pvt->model == 0x60) { + if (pvt->fam == 0x15 && pvt->model == 0x60) { f15h_select_dct(pvt, 0); pci_write_bits32(pvt->F2, F15H_M60H_SCRCTRL, scrubval, 0x001F); f15h_select_dct(pvt, 1); @@ -271,16 +254,7 @@ static int get_scrub_rate(struct mem_ctl_info *mci) int i, retval = -EINVAL; u32 scrubval = 0; - if (pvt->umc) { - 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); - scrubval &= 0xF; - scrubval += 0x5; - } else { - scrubval = 0; - } - } else if (pvt->fam == 0x15) { + if (pvt->fam == 0x15) { /* Erratum #505 */ if (pvt->model < 0x10) f15h_select_dct(pvt, 0); @@ -3967,6 +3941,9 @@ static void setup_mci_misc_attrs(struct mem_ctl_info *mci) mci->dev_name = pci_name(pvt->F3); mci->ctl_page_to_phys = NULL; + if (pvt->fam >= 0x17) + return; + /* memory scrubber interface */ mci->set_sdram_scrub_rate = set_scrub_rate; mci->get_sdram_scrub_rate = get_scrub_rate; diff --git a/drivers/edac/amd64_edac.h b/drivers/edac/amd64_edac.h index 38e5ad95d010..48f1d97e1274 100644 --- a/drivers/edac/amd64_edac.h +++ b/drivers/edac/amd64_edac.h @@ -215,8 +215,6 @@ #define DCT_SEL_HI 0x114 #define F15H_M60H_SCRCTRL 0x1C8 -#define F17H_SCR_BASE_ADDR 0x48 -#define F17H_SCR_LIMIT_ADDR 0x4C /* * Function 3 - Misc Control From patchwork Fri Jan 27 17:04:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 13119078 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46B1BC38142 for ; Fri, 27 Jan 2023 17:07:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235104AbjA0RHl (ORCPT ); Fri, 27 Jan 2023 12:07:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235026AbjA0RH1 (ORCPT ); Fri, 27 Jan 2023 12:07:27 -0500 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on20622.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e89::622]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8309986EAC; Fri, 27 Jan 2023 09:06:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cCZAj1A3GMK9n0/0aURDJ1MyWWDsRPAQoF3dKIHMUkNxFh1+yE0TKCZyC69xZQn5E4YOkFW0JuxXZH52QiMlTpSynhfjg5zzvQubU8AdDHMFRhSsywLv/NmUPI+4p1qh9LFKDlU4yi8W0RLl7X5Rjkw06vV/7TaomR1ZegvEBTewOfOhvG0W0DWkQGZ1pE7hT4XCe4l5IbJrqCry0xixQA3VDYLd5ZTtbG4pxqKdj+M3lEc/JWa2SSZ3YLMKj1qf4myQVpLIlxT6R1rcCqRIO8qJSDMH4kRasGISaAWVtZ5EQIFFz4oK3nHPzbzi7ibMDcrVZ2Vtx/o1jwpOGSOFMA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=TOw4CeLcFhN8zTDuNyCccuduK8o748M5EJqwKg6eRV8=; b=kG5X+ANrBeriwStRq/36lvCcBSA5m/N9CJJEsnGxjxyQcA6YxI100HTz0rNoA5zIiEMmeEV2VnoExICnL3jZzHB8jTwnket0L0PIfqlWcRdrSwWeVVJbXbbjhSb0T2JPvzVA22jy7o771CwLCh92RmPbghUQ1OpI97eLSx0nxF3GO/TbjwZGBiBwEoly7hfTrW2Q4p9/r7z5Y8bbtOWKrjWURUp+ZkPXRMMM0s4PXbl0ttBSz75iaZ8YjWgRmIL3B/puDyle7LL5UDPx6Vru0YUfYiHobhqvydjR9RL9PwqMBpt8iFN+BpaSKz2HynHLq0ux0ucj9iBam0o8gndg/w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TOw4CeLcFhN8zTDuNyCccuduK8o748M5EJqwKg6eRV8=; b=k2SK9e5Z0bFnL4tGJmlf55fV3lgSVPTXs+GUuOaHt7FLPYUi6ECkBK3DaTCIDKmnQjfsamISgM10IepGDirKcm3ZoZUQ1w7w4hUm3Yj7dJF2pn2TF33TxNXfjWjhoxH2cpZZJXkvYjX5ByVb+9+0LvVghR6yikaBftkWBWAu6RE= Received: from BN8PR04CA0060.namprd04.prod.outlook.com (2603:10b6:408:d4::34) by SA1PR12MB7343.namprd12.prod.outlook.com (2603:10b6:806:2b5::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.22; Fri, 27 Jan 2023 17:04:33 +0000 Received: from BN8NAM11FT089.eop-nam11.prod.protection.outlook.com (2603:10b6:408:d4:cafe::18) by BN8PR04CA0060.outlook.office365.com (2603:10b6:408:d4::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.22 via Frontend Transport; Fri, 27 Jan 2023 17:04:32 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT089.mail.protection.outlook.com (10.13.176.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6023.16 via Frontend Transport; Fri, 27 Jan 2023 17:04:32 +0000 Received: from yaz-ethanolx.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 27 Jan 2023 11:04:31 -0600 From: Yazen Ghannam To: , CC: , , , Yazen Ghannam Subject: [PATCH v2 03/22] EDAC/amd64: Remove PCI Function 6 Date: Fri, 27 Jan 2023 17:04:00 +0000 Message-ID: <20230127170419.1824692-4-yazen.ghannam@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230127170419.1824692-1-yazen.ghannam@amd.com> References: <20230127170419.1824692-1-yazen.ghannam@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT089:EE_|SA1PR12MB7343:EE_ X-MS-Office365-Filtering-Correlation-Id: ff0deac8-b69f-4a69-49fa-08db00888fb1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eph98u+DhyrWtv6+LR/wMYQFC+5Zlreb5zJTnmZD3LoMlv1U7jHoyZLY68XTXv/KgpReXionK8n3hlKMYUVFu67MjJyPT1l/vYKCCD8Inzue27IFGqlz2KTQmh7iSP0jywLI8ePKjkJsvVT5ZHgKhDZQs+cC9CGVbee2/rBx5EQaBhD01pMFP0AkJkIQpCQpJBUTnmj7IbCijHbntsyr3qmXZbUGgaVdzCT9wH/62X7/A8shKKTU3Oj2cTbQPcaVFgur/l8vsnl7C1ghPTGT+ZXjlj0BCJZPX1Do+on55eq0NUbpstDXu9gq+j/ajmlMjtzgb1JqkIEnxfMpJCXytaOi5iYHbmZzmCO13q50VNFdsMozrfttFBHblC1vnw143ZgTTFeGd+HKP9ZBOKRJYMfSDNmINFiOqOc2rcoacQUsEWUTv4kti+Fxw0eKB691Jf4bQs9oO5eNMLUBypNSzfja6GUFOYUhZ0ESybm+Rk+JD8gVSguMbhDnK2CO8VQQt63xd7/clczLXA9QSM7qDdaM6SJAfxT+8INiQSLP4sVyVm6grBrYsqIyNIdqFQQIDffeRKzav1QHhVFZo3SH55I3+gE8UxDlnV1B0Aaf3zGXtBHvOv//3gIvRAhquak9m9SKbZNZjDnu6mLkT5RqxbSWCrWUoADuDshTgZh+9Vmx7HiplzE1fhlwKM2I/cAh0oFX0cKgaQ2POHS++8EeZrGY5+xU9ih1lo85ZSx59vaAjsknVyFECFE7UYCFN0HtPFpTqbk8HcCg3IJ+tMcSnw== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230025)(4636009)(346002)(39860400002)(396003)(376002)(136003)(451199018)(46966006)(36840700001)(40470700004)(2906002)(44832011)(40460700003)(356005)(1076003)(81166007)(110136005)(2616005)(36860700001)(186003)(70586007)(336012)(26005)(426003)(40480700001)(16526019)(83380400001)(70206006)(6666004)(47076005)(4326008)(5660300002)(86362001)(8676002)(316002)(8936002)(966005)(36756003)(41300700001)(7696005)(478600001)(82740400003)(54906003)(82310400005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2023 17:04:32.8901 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ff0deac8-b69f-4a69-49fa-08db00888fb1 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT089.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7343 Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org PCI Function 6 is used on Family 17h and later to access scrub registers. With scrub access removed, this function has no other use. Remove all Function 6 PCI IDs and related code. Signed-off-by: Yazen Ghannam --- Link: https://lore.kernel.org/r/20220509145534.44912-4-yazen.ghannam@amd.com v1->v2: * Also remove "pvt->F6" pointer. drivers/edac/amd64_edac.c | 22 +--------------------- drivers/edac/amd64_edac.h | 12 ++---------- 2 files changed, 3 insertions(+), 31 deletions(-) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 07a89df0d4f4..dce2179ad454 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -2906,7 +2906,6 @@ static struct amd64_family_type family_types[] = { [F17_CPUS] = { .ctl_name = "F17h", .f0_id = PCI_DEVICE_ID_AMD_17H_DF_F0, - .f6_id = PCI_DEVICE_ID_AMD_17H_DF_F6, .max_mcs = 2, .ops = { .early_channel_count = f17_early_channel_count, @@ -2916,7 +2915,6 @@ static struct amd64_family_type family_types[] = { [F17_M10H_CPUS] = { .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_mcs = 2, .ops = { .early_channel_count = f17_early_channel_count, @@ -2926,7 +2924,6 @@ static struct amd64_family_type family_types[] = { [F17_M30H_CPUS] = { .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_mcs = 8, .ops = { .early_channel_count = f17_early_channel_count, @@ -2936,7 +2933,6 @@ static struct amd64_family_type family_types[] = { [F17_M60H_CPUS] = { .ctl_name = "F17h_M60h", .f0_id = PCI_DEVICE_ID_AMD_17H_M60H_DF_F0, - .f6_id = PCI_DEVICE_ID_AMD_17H_M60H_DF_F6, .max_mcs = 2, .ops = { .early_channel_count = f17_early_channel_count, @@ -2946,7 +2942,6 @@ static struct amd64_family_type family_types[] = { [F17_M70H_CPUS] = { .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_mcs = 2, .ops = { .early_channel_count = f17_early_channel_count, @@ -2956,7 +2951,6 @@ static struct amd64_family_type family_types[] = { [F19_CPUS] = { .ctl_name = "F19h", .f0_id = PCI_DEVICE_ID_AMD_19H_DF_F0, - .f6_id = PCI_DEVICE_ID_AMD_19H_DF_F6, .max_mcs = 8, .ops = { .early_channel_count = f17_early_channel_count, @@ -2966,7 +2960,6 @@ static struct amd64_family_type family_types[] = { [F19_M10H_CPUS] = { .ctl_name = "F19h_M10h", .f0_id = PCI_DEVICE_ID_AMD_19H_M10H_DF_F0, - .f6_id = PCI_DEVICE_ID_AMD_19H_M10H_DF_F6, .max_mcs = 12, .flags.zn_regs_v2 = 1, .ops = { @@ -2977,7 +2970,6 @@ static struct amd64_family_type family_types[] = { [F19_M50H_CPUS] = { .ctl_name = "F19h_M50h", .f0_id = PCI_DEVICE_ID_AMD_19H_M50H_DF_F0, - .f6_id = PCI_DEVICE_ID_AMD_19H_M50H_DF_F6, .max_mcs = 2, .ops = { .early_channel_count = f17_early_channel_count, @@ -3290,7 +3282,7 @@ static void decode_umc_error(int node_id, struct mce *m) /* * Use pvt->F3 which contains the F3 CPU PCI device to get the related * F1 (AddrMap) and F2 (Dct) devices. Return negative value on error. - * Reserve F0 and F6 on systems with a UMC. + * Reserve F0 on systems with a UMC. */ static int reserve_mc_sibling_devs(struct amd64_pvt *pvt, u16 pci_id1, u16 pci_id2) @@ -3302,21 +3294,11 @@ reserve_mc_sibling_devs(struct amd64_pvt *pvt, u16 pci_id1, u16 pci_id2) return -ENODEV; } - pvt->F6 = pci_get_related_function(pvt->F3->vendor, pci_id2, pvt->F3); - if (!pvt->F6) { - pci_dev_put(pvt->F0); - pvt->F0 = NULL; - - edac_dbg(1, "F6 not found: device 0x%x\n", pci_id2); - return -ENODEV; - } - if (!pci_ctl_dev) pci_ctl_dev = &pvt->F0->dev; edac_dbg(1, "F0: %s\n", pci_name(pvt->F0)); edac_dbg(1, "F3: %s\n", pci_name(pvt->F3)); - edac_dbg(1, "F6: %s\n", pci_name(pvt->F6)); return 0; } @@ -3352,7 +3334,6 @@ static void free_mc_sibling_devs(struct amd64_pvt *pvt) { if (pvt->umc) { pci_dev_put(pvt->F0); - pci_dev_put(pvt->F6); } else { pci_dev_put(pvt->F1); pci_dev_put(pvt->F2); @@ -4078,7 +4059,6 @@ static int hw_info_get(struct amd64_pvt *pvt) return -ENOMEM; pci_id1 = fam_type->f0_id; - pci_id2 = fam_type->f6_id; } else { pci_id1 = fam_type->f1_id; pci_id2 = fam_type->f2_id; diff --git a/drivers/edac/amd64_edac.h b/drivers/edac/amd64_edac.h index 48f1d97e1274..2d5ea9ca3868 100644 --- a/drivers/edac/amd64_edac.h +++ b/drivers/edac/amd64_edac.h @@ -115,21 +115,13 @@ #define PCI_DEVICE_ID_AMD_16H_M30H_NB_F1 0x1581 #define PCI_DEVICE_ID_AMD_16H_M30H_NB_F2 0x1582 #define PCI_DEVICE_ID_AMD_17H_DF_F0 0x1460 -#define PCI_DEVICE_ID_AMD_17H_DF_F6 0x1466 #define PCI_DEVICE_ID_AMD_17H_M10H_DF_F0 0x15e8 -#define PCI_DEVICE_ID_AMD_17H_M10H_DF_F6 0x15ee #define PCI_DEVICE_ID_AMD_17H_M30H_DF_F0 0x1490 -#define PCI_DEVICE_ID_AMD_17H_M30H_DF_F6 0x1496 #define PCI_DEVICE_ID_AMD_17H_M60H_DF_F0 0x1448 -#define PCI_DEVICE_ID_AMD_17H_M60H_DF_F6 0x144e #define PCI_DEVICE_ID_AMD_17H_M70H_DF_F0 0x1440 -#define PCI_DEVICE_ID_AMD_17H_M70H_DF_F6 0x1446 #define PCI_DEVICE_ID_AMD_19H_DF_F0 0x1650 -#define PCI_DEVICE_ID_AMD_19H_DF_F6 0x1656 #define PCI_DEVICE_ID_AMD_19H_M10H_DF_F0 0x14ad -#define PCI_DEVICE_ID_AMD_19H_M10H_DF_F6 0x14b3 #define PCI_DEVICE_ID_AMD_19H_M50H_DF_F0 0x166a -#define PCI_DEVICE_ID_AMD_19H_M50H_DF_F6 0x1670 /* * Function 1 - Address Map @@ -354,7 +346,7 @@ struct amd64_pvt { struct low_ops *ops; /* pci_device handles which we utilize */ - struct pci_dev *F0, *F1, *F2, *F3, *F6; + struct pci_dev *F0, *F1, *F2, *F3; u16 mc_node_id; /* MC index of this MC node */ u8 fam; /* CPU family */ @@ -501,7 +493,7 @@ struct amd64_family_flags { struct amd64_family_type { const char *ctl_name; - u16 f0_id, f1_id, f2_id, f6_id; + u16 f0_id, f1_id, f2_id; /* Maximum number of memory controllers per die/node. */ u8 max_mcs; struct amd64_family_flags flags; From patchwork Fri Jan 27 17:04:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 13119060 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 41555C61D97 for ; Fri, 27 Jan 2023 17:05:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234841AbjA0RF3 (ORCPT ); Fri, 27 Jan 2023 12:05:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234542AbjA0RFZ (ORCPT ); Fri, 27 Jan 2023 12:05:25 -0500 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on20627.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe5a::627]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 613D584F8F; Fri, 27 Jan 2023 09:04:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SOb/JTQRa++zJOAnSkkO+Y2AO6kd41oyaDiaocgnWmShHjZ/vrNBDbXIdWPEvmmhQMhYMQbFe80KbFTCaJSo/9aj4S6vKBfMM1556tk7UuvTDPSTzCFq2qL9C2/3G5n4BC83eMKjlyzERrZbtOQyvAEjKpr5y5ikPfADHjDIVrRYBPDEEoUqhfVDNs7ZwxG8ekoxugfQt8q5ASo8MAcmHguMabk84VtNTQUcWU9EWmdfLm1PKkynkcNhVyiynBe83SJD+kH5CfWRH6BaV8gYmH8q5BFtsxvUdfeNExQGROJCtAp7IcetvGlrKiwS+bibbS+3hIOCyC4iBggFnQMaNQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=9PcZgMg019jjIigLGM5JL7QfFpfLdgsHGV9Ftqn6YtA=; b=euMVatYfzf2gOWL2lm+Vya0UN5BJp2lxYFppT8i7sZBCjZbLMZ62M2PVmQ3eZlZrJDecx6cvggm4sgY1tkRpy9ir9OFonXxvzwB+tl7li0x06xWe2nd1r17g6vkymFKuPN716ECI95GxvKulT6Hu4qq+gKepSyw1g3681e1e7uhHDxYSKuWjbDRVKWR7FDPCV08kUkoMQ1L4R0EX4MC4VwROVhUtLkl7GiYyWR6hb7OYQre0kXIqtyMMRy+4fqzmsm184Td3edPLCADEIjWwbthx2JC+zv5G3tpJAMWv2tzgM8cSuj96ecdeLHQJl/YCCYnh4ydXrpf6OTK+TtQULg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9PcZgMg019jjIigLGM5JL7QfFpfLdgsHGV9Ftqn6YtA=; b=yeEWmyBND2Ot3zH8FwZdOoqmCKYqvBW61kFkL55nuxuvuOHN3c0yljY4F3HD0RvKadih67pw6xOsdACZIkUG/5Owutzg77Mwwievb1f3NdTokI6rGEXdCWyH0SQjLmOwc4ONOv5vPklvfaxatsZjk76yUTKepfM2cS/qiKskw2s= Received: from BN8PR04CA0037.namprd04.prod.outlook.com (2603:10b6:408:d4::11) by MN6PR12MB8472.namprd12.prod.outlook.com (2603:10b6:208:46c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.22; Fri, 27 Jan 2023 17:04:33 +0000 Received: from BN8NAM11FT089.eop-nam11.prod.protection.outlook.com (2603:10b6:408:d4:cafe::5e) by BN8PR04CA0037.outlook.office365.com (2603:10b6:408:d4::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.23 via Frontend Transport; Fri, 27 Jan 2023 17:04:33 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT089.mail.protection.outlook.com (10.13.176.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6023.16 via Frontend Transport; Fri, 27 Jan 2023 17:04:33 +0000 Received: from yaz-ethanolx.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 27 Jan 2023 11:04:31 -0600 From: Yazen Ghannam To: , CC: , , , Yazen Ghannam Subject: [PATCH v2 04/22] EDAC/amd64: Remove PCI Function 0 Date: Fri, 27 Jan 2023 17:04:01 +0000 Message-ID: <20230127170419.1824692-5-yazen.ghannam@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230127170419.1824692-1-yazen.ghannam@amd.com> References: <20230127170419.1824692-1-yazen.ghannam@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT089:EE_|MN6PR12MB8472:EE_ X-MS-Office365-Filtering-Correlation-Id: 2937749a-b5aa-4117-ba74-08db00889004 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LLThrg8puIiyQjU2EKx1FXamp0vGKpK2aJpddVxR59HvkbM1qju+cg5orP5mLEtVdHlfuSexbBHgVeOn+N6q0ilYRv9UjFi+YHD5ekjQGQAd8xHAKb8KO/P28JIApvY0T6QPnQCcPsmdXPqSEONnJhV48jV8Y6+N0xqeavgsO06d9Mpe0t2MM1zo5Ymeu76RSXXl1wMu3iq4l5wC/U/DbvOygk0ftPFezNe2z1r72vt0hTZYrI2g3fZVSvv3cLrtVBWQEWlcN06MWBhCC3WyYwHVhInZd1lous1USQ8manF7BJTbyo7J3Ru3PfsclaRSwgtGXuZH4q1Ro1kvBe2hUC6rYdFg/V9iQM2j3CA4PIx4eBusb2RqdwTYAGZWbhc46CbvlbTcZnSauUnprF4g1eRJCS6rCrIdOpZc1NkqJLUU2UzjFAP0q2sLCDDOb8cqZm1oGaT8gPuIWymGkiKXKm2qqiwWOdRLkhRX1qVn0vUw2Q6XQUkmTSBwRzHeYjuRbsHmybWvoyrkaUal0uoo0wz4NSe8RGi6S7UgxpVFTr41+kD41fWshoyLypGTyM5dyKF5zbA58id5Rvlx3+r1AlWroJsT36N0VKYm1dniFaFx5MMnf6dBRSCaMMM7C6TUT7s/NDBAOXtFae8rwKxcJ8aqoR1vVAl0mvCXOEu3I5A0sqQEf1KuZXJ5fKh0KFJsOFns2Yv2fKe+UgWo8z5bNIiAg7nrw0dih49K355FrQzRGJtq0k5DuZQbrVrGVYCB4ynYjKWxH8a6fFHL0fJKlw== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230025)(4636009)(396003)(39860400002)(376002)(346002)(136003)(451199018)(46966006)(40470700004)(36840700001)(4326008)(2616005)(186003)(26005)(16526019)(336012)(36860700001)(82310400005)(83380400001)(356005)(36756003)(40460700003)(40480700001)(82740400003)(81166007)(86362001)(426003)(47076005)(70206006)(70586007)(8676002)(316002)(44832011)(41300700001)(8936002)(5660300002)(2906002)(54906003)(478600001)(7696005)(966005)(6666004)(1076003)(110136005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2023 17:04:33.4369 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2937749a-b5aa-4117-ba74-08db00889004 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT089.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN6PR12MB8472 Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org PCI Function 0 is used on Family 17h and later only to read the "dhar" value. This value is printed and provided through a module-specific debug sysfs file. The value is not used for any Family 17h and later code, and it does not have any apparent debug value on these systems. Remove "dhar", Function 0 PCI IDs, and all related code. Signed-off-by: Yazen Ghannam --- Link: https://lore.kernel.org/r/20220509145534.44912-5-yazen.ghannam@amd.com v1->v2: * Also remove "pvt->F0" pointer. drivers/edac/amd64_edac.c | 38 +++++--------------------------------- drivers/edac/amd64_edac.h | 12 ++---------- 2 files changed, 7 insertions(+), 43 deletions(-) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index dce2179ad454..352cbcda53f9 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -1428,9 +1428,6 @@ static void __dump_misc_regs_df(struct amd64_pvt *pvt) debug_display_dimm_sizes_df(pvt, i); } - - edac_dbg(1, "F0x104 (DRAM Hole Address): 0x%08x, base: 0x%08x\n", - pvt->dhar, dhar_base(pvt)); } /* Display and decode various NB registers for debug purposes. */ @@ -1465,6 +1462,8 @@ static void __dump_misc_regs(struct amd64_pvt *pvt) /* Only if NOT ganged does dclr1 have valid info */ if (!dct_ganging_enabled(pvt)) debug_dump_dramcfg_low(pvt, pvt->dclr1, 1); + + edac_dbg(1, " DramHoleValid: %s\n", dhar_valid(pvt) ? "yes" : "no"); } /* Display and decode various NB registers for debug purposes. */ @@ -1475,8 +1474,6 @@ static void dump_misc_regs(struct amd64_pvt *pvt) else __dump_misc_regs(pvt); - edac_dbg(1, " DramHoleValid: %s\n", dhar_valid(pvt) ? "yes" : "no"); - amd64_info("using x%u syndromes.\n", pvt->ecc_sym_sz); } @@ -2905,7 +2902,6 @@ static struct amd64_family_type family_types[] = { }, [F17_CPUS] = { .ctl_name = "F17h", - .f0_id = PCI_DEVICE_ID_AMD_17H_DF_F0, .max_mcs = 2, .ops = { .early_channel_count = f17_early_channel_count, @@ -2914,7 +2910,6 @@ static struct amd64_family_type family_types[] = { }, [F17_M10H_CPUS] = { .ctl_name = "F17h_M10h", - .f0_id = PCI_DEVICE_ID_AMD_17H_M10H_DF_F0, .max_mcs = 2, .ops = { .early_channel_count = f17_early_channel_count, @@ -2923,7 +2918,6 @@ static struct amd64_family_type family_types[] = { }, [F17_M30H_CPUS] = { .ctl_name = "F17h_M30h", - .f0_id = PCI_DEVICE_ID_AMD_17H_M30H_DF_F0, .max_mcs = 8, .ops = { .early_channel_count = f17_early_channel_count, @@ -2932,7 +2926,6 @@ static struct amd64_family_type family_types[] = { }, [F17_M60H_CPUS] = { .ctl_name = "F17h_M60h", - .f0_id = PCI_DEVICE_ID_AMD_17H_M60H_DF_F0, .max_mcs = 2, .ops = { .early_channel_count = f17_early_channel_count, @@ -2941,7 +2934,6 @@ static struct amd64_family_type family_types[] = { }, [F17_M70H_CPUS] = { .ctl_name = "F17h_M70h", - .f0_id = PCI_DEVICE_ID_AMD_17H_M70H_DF_F0, .max_mcs = 2, .ops = { .early_channel_count = f17_early_channel_count, @@ -2950,7 +2942,6 @@ static struct amd64_family_type family_types[] = { }, [F19_CPUS] = { .ctl_name = "F19h", - .f0_id = PCI_DEVICE_ID_AMD_19H_DF_F0, .max_mcs = 8, .ops = { .early_channel_count = f17_early_channel_count, @@ -2959,7 +2950,6 @@ static struct amd64_family_type family_types[] = { }, [F19_M10H_CPUS] = { .ctl_name = "F19h_M10h", - .f0_id = PCI_DEVICE_ID_AMD_19H_M10H_DF_F0, .max_mcs = 12, .flags.zn_regs_v2 = 1, .ops = { @@ -2969,7 +2959,6 @@ static struct amd64_family_type family_types[] = { }, [F19_M50H_CPUS] = { .ctl_name = "F19h_M50h", - .f0_id = PCI_DEVICE_ID_AMD_19H_M50H_DF_F0, .max_mcs = 2, .ops = { .early_channel_count = f17_early_channel_count, @@ -3282,26 +3271,12 @@ static void decode_umc_error(int node_id, struct mce *m) /* * Use pvt->F3 which contains the F3 CPU PCI device to get the related * F1 (AddrMap) and F2 (Dct) devices. Return negative value on error. - * Reserve F0 on systems with a UMC. */ static int reserve_mc_sibling_devs(struct amd64_pvt *pvt, u16 pci_id1, u16 pci_id2) { - if (pvt->umc) { - pvt->F0 = pci_get_related_function(pvt->F3->vendor, pci_id1, pvt->F3); - if (!pvt->F0) { - edac_dbg(1, "F0 not found, device 0x%x\n", pci_id1); - return -ENODEV; - } - - if (!pci_ctl_dev) - pci_ctl_dev = &pvt->F0->dev; - - edac_dbg(1, "F0: %s\n", pci_name(pvt->F0)); - edac_dbg(1, "F3: %s\n", pci_name(pvt->F3)); - + if (pvt->umc) return 0; - } /* Reserve the ADDRESS MAP Device */ pvt->F1 = pci_get_related_function(pvt->F3->vendor, pci_id1, pvt->F3); @@ -3333,7 +3308,7 @@ reserve_mc_sibling_devs(struct amd64_pvt *pvt, u16 pci_id1, u16 pci_id2) static void free_mc_sibling_devs(struct amd64_pvt *pvt) { if (pvt->umc) { - pci_dev_put(pvt->F0); + return; } else { pci_dev_put(pvt->F1); pci_dev_put(pvt->F2); @@ -3423,7 +3398,6 @@ static void read_mc_regs(struct amd64_pvt *pvt) if (pvt->umc) { __read_mc_regs_df(pvt); - amd64_read_pci_cfg(pvt->F0, DF_DHAR, &pvt->dhar); goto skip; } @@ -4057,8 +4031,6 @@ static int hw_info_get(struct amd64_pvt *pvt) pvt->umc = kcalloc(fam_type->max_mcs, sizeof(struct amd64_umc), GFP_KERNEL); if (!pvt->umc) return -ENOMEM; - - pci_id1 = fam_type->f0_id; } else { pci_id1 = fam_type->f1_id; pci_id2 = fam_type->f2_id; @@ -4075,7 +4047,7 @@ static int hw_info_get(struct amd64_pvt *pvt) static void hw_info_put(struct amd64_pvt *pvt) { - if (pvt->F0 || pvt->F1) + if (pvt->F1) free_mc_sibling_devs(pvt); kfree(pvt->umc); diff --git a/drivers/edac/amd64_edac.h b/drivers/edac/amd64_edac.h index 2d5ea9ca3868..398fb58dacbf 100644 --- a/drivers/edac/amd64_edac.h +++ b/drivers/edac/amd64_edac.h @@ -114,14 +114,6 @@ #define PCI_DEVICE_ID_AMD_16H_NB_F2 0x1532 #define PCI_DEVICE_ID_AMD_16H_M30H_NB_F1 0x1581 #define PCI_DEVICE_ID_AMD_16H_M30H_NB_F2 0x1582 -#define PCI_DEVICE_ID_AMD_17H_DF_F0 0x1460 -#define PCI_DEVICE_ID_AMD_17H_M10H_DF_F0 0x15e8 -#define PCI_DEVICE_ID_AMD_17H_M30H_DF_F0 0x1490 -#define PCI_DEVICE_ID_AMD_17H_M60H_DF_F0 0x1448 -#define PCI_DEVICE_ID_AMD_17H_M70H_DF_F0 0x1440 -#define PCI_DEVICE_ID_AMD_19H_DF_F0 0x1650 -#define PCI_DEVICE_ID_AMD_19H_M10H_DF_F0 0x14ad -#define PCI_DEVICE_ID_AMD_19H_M50H_DF_F0 0x166a /* * Function 1 - Address Map @@ -346,7 +338,7 @@ struct amd64_pvt { struct low_ops *ops; /* pci_device handles which we utilize */ - struct pci_dev *F0, *F1, *F2, *F3; + struct pci_dev *F1, *F2, *F3; u16 mc_node_id; /* MC index of this MC node */ u8 fam; /* CPU family */ @@ -493,7 +485,7 @@ struct amd64_family_flags { struct amd64_family_type { const char *ctl_name; - u16 f0_id, f1_id, f2_id; + u16 f1_id, f2_id; /* Maximum number of memory controllers per die/node. */ u8 max_mcs; struct amd64_family_flags flags; From patchwork Fri Jan 27 17:04:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 13119075 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6BB45C54EAA for ; Fri, 27 Jan 2023 17:06:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235052AbjA0RGg (ORCPT ); Fri, 27 Jan 2023 12:06:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235049AbjA0RGG (ORCPT ); Fri, 27 Jan 2023 12:06:06 -0500 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2054.outbound.protection.outlook.com [40.107.92.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB08E84B64; Fri, 27 Jan 2023 09:05:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b4G3827lXFpSy0+3tNZAwGbeZWxLJDAblaDpb4R0+0/k1I7loda7MMOTuqicZQl94PxqPLp7LFHH0+ANWji8JQ+eywL6Isi5lAfoEHhAAFPjfRwMUk5VX6x3l307o6g+hySPw+9jEZn25qX2Oivl16OCgamVtmUEu8n2+lyAUAzvKcGX0uPm0FAZu/CNb7lDOmt8+x/Jq1RadzPpXwVDTpekmiHQFtbgbuWV5CTuGsMmwKixxJ2Q50tQjUVL7bN7pyswgJjiEK0aAU8yeURXS/UVWz07+vXW6pNw7BXo8ZancdLcRgG8yo2l29FhvM+nzsmltqhHsPWhcIsFbY4p8A== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=x2IgvE9TU2YO6XPGd29qJ+TgRhdjCT7uD4FYbjwA3FE=; b=E7vXkZdAYhTskHvkGy+hKK2Si+7hGThxbok2YesepN3Nm836W2HO5dLEYPRzyDukGZbcl+u5LFxcHszSlVYbkeNlOEfpDvbDkncYOj9frUk+9r+y6IjykSVZu5gWZuxOyqXSj5YBCWEB8fJOXfS2xs2Z98xNX/cxn0QaG+IJx5IAI2VfM1rAZn5bj2whFjvMOxSGMJN95T7wPN/HjldqkSsWNr0LGidV4pw6vnHTHEwSGBb/oFp8hZH4eJqNFY1ffNmVkbHXkdYoaCJLy5pQkbs+EtBznjm/YzpiX8aKwci3EUM0oIDTa/CCxiN9q8CF+VmyTZ5TA8FU1kCKpkX2PQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=x2IgvE9TU2YO6XPGd29qJ+TgRhdjCT7uD4FYbjwA3FE=; b=BUOOqFabURlJ0E2w7MLE9GBp+PMrEeLqg8lG6c/C8osExb8aOJxRIEB94zonD53zDL+JCGw6c/uMd1GZm+tU9C+99rAOGu8IJ3KL6BLb/10NhhujRhRBoUfukWLvdFTwg31O3I5z7//oujVAheMhYa7qjUxBG0hVfcmCCLkym8k= Received: from BN8PR04CA0061.namprd04.prod.outlook.com (2603:10b6:408:d4::35) by BL3PR12MB6378.namprd12.prod.outlook.com (2603:10b6:208:3b1::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.25; Fri, 27 Jan 2023 17:04:33 +0000 Received: from BN8NAM11FT089.eop-nam11.prod.protection.outlook.com (2603:10b6:408:d4:cafe::a3) by BN8PR04CA0061.outlook.office365.com (2603:10b6:408:d4::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.25 via Frontend Transport; Fri, 27 Jan 2023 17:04:33 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT089.mail.protection.outlook.com (10.13.176.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6023.16 via Frontend Transport; Fri, 27 Jan 2023 17:04:33 +0000 Received: from yaz-ethanolx.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 27 Jan 2023 11:04:32 -0600 From: Yazen Ghannam To: , CC: , , , Yazen Ghannam Subject: [PATCH v2 05/22] EDAC/amd64: Remove early_channel_count() Date: Fri, 27 Jan 2023 17:04:02 +0000 Message-ID: <20230127170419.1824692-6-yazen.ghannam@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230127170419.1824692-1-yazen.ghannam@amd.com> References: <20230127170419.1824692-1-yazen.ghannam@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT089:EE_|BL3PR12MB6378:EE_ X-MS-Office365-Filtering-Correlation-Id: 4231b723-52ed-4394-2d0c-08db00889039 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Aeg8hUfqNodtX+IHC9Rha2ebGvSyDfLnPwGLdo4RTzk2SfSvXEWvRamHVWacoAW0ajpF6v65YoFFVg7sPgDRvbB9wGEKls7x6evDJYb9m5i8DAglnBJLOMRguEvk8GlUHkDXJm67TXuQ7rSWBLQs9M7KU2/Jg6SKalPuoxzcVthnNyB6jo1YjaT1xuAtAKG3WZ4BSi+inrdpyz26Ip1DzLiAn+GcpAwcyz3L4SV+Or9j0g/pq04vw2jurb06xBbxET2oUt6cGr+iLqzAJDA4xNG63FR2y0bmZ4RdVt8OEMgH64SNcFQOOSLUQ/B6Eol8stZVAsiBNwTRxMeRlDR/z7EFX/Y6bIjItTSNV8TkU7pxoWgSXMwquyHzNzQw5b0cHaNTywPy0aIxdIo+FLJrreSb54IjnCgbUgUFlIS7arbm0WY1DC9TosRdy4Bscn7oELVDNV/uWFVaViWE5SGuPeU2ElqNwLXwg5OOJ9Wo57zp2OmhsNc0fBG+T1QZKfwkx4+ZMWbI01IwssB7yydwkni6ASp2s7JcE5hyl/qFklzlIL/YAMKEDQTj8MlEXU/kDVPEIRMbIrvTa4brT3qUu7p260Bmn6TaV498HgQ59EO6FPrsh4yP2NWJJafHb4qqcAjgcLHGxdWnS2Ol1klHbWEYgcaN368v8ILjmF5/0LATYw2fGX+ecwKiB/cvKlSBJS7tzmKoGTgebczAObT4ZDlQ2ktboB1mppZ7yI2eUSdeF+k8y7DCf+msDinCA5pT3ZWfiF6r8LvNoYIAGHMnBg== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230025)(4636009)(346002)(39860400002)(396003)(376002)(136003)(451199018)(46966006)(36840700001)(40470700004)(86362001)(7696005)(36860700001)(82310400005)(82740400003)(336012)(8936002)(26005)(186003)(41300700001)(316002)(16526019)(356005)(36756003)(966005)(47076005)(426003)(54906003)(478600001)(1076003)(110136005)(2616005)(44832011)(40480700001)(6666004)(81166007)(8676002)(70586007)(70206006)(40460700003)(4326008)(2906002)(5660300002)(83380400001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2023 17:04:33.7806 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4231b723-52ed-4394-2d0c-08db00889039 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT089.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR12MB6378 Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org The early_channel_count() function seems to have been useful in the past for knowing how many EDAC mci structures to populate. However, this is no longer needed as the maximum channel count for a system is used instead. Remove the early_channel_count() helper functions and related code. Use the size of the channel layer when iterating over channel structures. Signed-off-by: Yazen Ghannam --- Link: https://lore.kernel.org/r/20220509145534.44912-1-yazen.ghannam@amd.com v1->v2: * New in v2. drivers/edac/amd64_edac.c | 116 +------------------------------------- drivers/edac/amd64_edac.h | 2 - 2 files changed, 2 insertions(+), 116 deletions(-) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 352cbcda53f9..1c4bef1cdf28 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -1703,24 +1703,6 @@ static void determine_memory_type(struct amd64_pvt *pvt) pvt->dram_type = (pvt->dclr0 & BIT(16)) ? MEM_DDR3 : MEM_RDDR3; } -/* Get the number of DCT channels the memory controller is using. */ -static int k8_early_channel_count(struct amd64_pvt *pvt) -{ - int flag; - - if (pvt->ext_model >= K8_REV_F) - /* RevF (NPT) and later */ - flag = pvt->dclr0 & WIDTH_128; - else - /* RevE and earlier */ - flag = pvt->dclr0 & REVE_WIDTH_128; - - /* not used */ - pvt->dclr1 = 0; - - return (flag) ? 2 : 1; -} - /* On F10h and later ErrAddr is MC4_ADDR[47:1] */ static u64 get_error_address(struct amd64_pvt *pvt, struct mce *m) { @@ -1972,69 +1954,6 @@ static int k8_dbam_to_chip_select(struct amd64_pvt *pvt, u8 dct, } } -/* - * Get the number of DCT channels in use. - * - * Return: - * number of Memory Channels in operation - * Pass back: - * contents of the DCL0_LOW register - */ -static int f1x_early_channel_count(struct amd64_pvt *pvt) -{ - int i, j, channels = 0; - - /* On F10h, if we are in 128 bit mode, then we are using 2 channels */ - if (pvt->fam == 0x10 && (pvt->dclr0 & WIDTH_128)) - return 2; - - /* - * Need to check if in unganged mode: In such, there are 2 channels, - * but they are not in 128 bit mode and thus the above 'dclr0' status - * bit will be OFF. - * - * Need to check DCT0[0] and DCT1[0] to see if only one of them has - * their CSEnable bit on. If so, then SINGLE DIMM case. - */ - edac_dbg(0, "Data width is not 128 bits - need more decoding\n"); - - /* - * Check DRAM Bank Address Mapping values for each DIMM to see if there - * is more than just one DIMM present in unganged mode. Need to check - * both controllers since DIMMs can be placed in either one. - */ - for (i = 0; i < 2; i++) { - u32 dbam = (i ? pvt->dbam1 : pvt->dbam0); - - for (j = 0; j < 4; j++) { - if (DBAM_DIMM(j, dbam) > 0) { - channels++; - break; - } - } - } - - if (channels > 2) - channels = 2; - - amd64_info("MCT channel count: %d\n", channels); - - return channels; -} - -static int f17_early_channel_count(struct amd64_pvt *pvt) -{ - int i, channels = 0; - - /* SDP Control bit 31 (SdpInit) is clear for unused UMC channels */ - for_each_umc(i) - channels += !!(pvt->umc[i].sdp_ctrl & UMC_SDP_INIT); - - amd64_info("MCT channel count: %d\n", channels); - - return channels; -} - static int ddr3_cs_size(unsigned i, bool dct_width) { unsigned shift = 0; @@ -2829,7 +2748,6 @@ static struct amd64_family_type family_types[] = { .f2_id = PCI_DEVICE_ID_AMD_K8_NB_MEMCTL, .max_mcs = 2, .ops = { - .early_channel_count = k8_early_channel_count, .map_sysaddr_to_csrow = k8_map_sysaddr_to_csrow, .dbam_to_cs = k8_dbam_to_chip_select, } @@ -2840,7 +2758,6 @@ static struct amd64_family_type family_types[] = { .f2_id = PCI_DEVICE_ID_AMD_10H_NB_DRAM, .max_mcs = 2, .ops = { - .early_channel_count = f1x_early_channel_count, .map_sysaddr_to_csrow = f1x_map_sysaddr_to_csrow, .dbam_to_cs = f10_dbam_to_chip_select, } @@ -2851,7 +2768,6 @@ static struct amd64_family_type family_types[] = { .f2_id = PCI_DEVICE_ID_AMD_15H_NB_F2, .max_mcs = 2, .ops = { - .early_channel_count = f1x_early_channel_count, .map_sysaddr_to_csrow = f1x_map_sysaddr_to_csrow, .dbam_to_cs = f15_dbam_to_chip_select, } @@ -2862,7 +2778,6 @@ static struct amd64_family_type family_types[] = { .f2_id = PCI_DEVICE_ID_AMD_15H_M30H_NB_F2, .max_mcs = 2, .ops = { - .early_channel_count = f1x_early_channel_count, .map_sysaddr_to_csrow = f1x_map_sysaddr_to_csrow, .dbam_to_cs = f16_dbam_to_chip_select, } @@ -2873,7 +2788,6 @@ static struct amd64_family_type family_types[] = { .f2_id = PCI_DEVICE_ID_AMD_15H_M60H_NB_F2, .max_mcs = 2, .ops = { - .early_channel_count = f1x_early_channel_count, .map_sysaddr_to_csrow = f1x_map_sysaddr_to_csrow, .dbam_to_cs = f15_m60h_dbam_to_chip_select, } @@ -2884,7 +2798,6 @@ static struct amd64_family_type family_types[] = { .f2_id = PCI_DEVICE_ID_AMD_16H_NB_F2, .max_mcs = 2, .ops = { - .early_channel_count = f1x_early_channel_count, .map_sysaddr_to_csrow = f1x_map_sysaddr_to_csrow, .dbam_to_cs = f16_dbam_to_chip_select, } @@ -2895,7 +2808,6 @@ static struct amd64_family_type family_types[] = { .f2_id = PCI_DEVICE_ID_AMD_16H_M30H_NB_F2, .max_mcs = 2, .ops = { - .early_channel_count = f1x_early_channel_count, .map_sysaddr_to_csrow = f1x_map_sysaddr_to_csrow, .dbam_to_cs = f16_dbam_to_chip_select, } @@ -2904,7 +2816,6 @@ static struct amd64_family_type family_types[] = { .ctl_name = "F17h", .max_mcs = 2, .ops = { - .early_channel_count = f17_early_channel_count, .dbam_to_cs = f17_addr_mask_to_cs_size, } }, @@ -2912,7 +2823,6 @@ static struct amd64_family_type family_types[] = { .ctl_name = "F17h_M10h", .max_mcs = 2, .ops = { - .early_channel_count = f17_early_channel_count, .dbam_to_cs = f17_addr_mask_to_cs_size, } }, @@ -2920,7 +2830,6 @@ static struct amd64_family_type family_types[] = { .ctl_name = "F17h_M30h", .max_mcs = 8, .ops = { - .early_channel_count = f17_early_channel_count, .dbam_to_cs = f17_addr_mask_to_cs_size, } }, @@ -2928,7 +2837,6 @@ static struct amd64_family_type family_types[] = { .ctl_name = "F17h_M60h", .max_mcs = 2, .ops = { - .early_channel_count = f17_early_channel_count, .dbam_to_cs = f17_addr_mask_to_cs_size, } }, @@ -2936,7 +2844,6 @@ static struct amd64_family_type family_types[] = { .ctl_name = "F17h_M70h", .max_mcs = 2, .ops = { - .early_channel_count = f17_early_channel_count, .dbam_to_cs = f17_addr_mask_to_cs_size, } }, @@ -2944,7 +2851,6 @@ static struct amd64_family_type family_types[] = { .ctl_name = "F19h", .max_mcs = 8, .ops = { - .early_channel_count = f17_early_channel_count, .dbam_to_cs = f17_addr_mask_to_cs_size, } }, @@ -2953,7 +2859,6 @@ static struct amd64_family_type family_types[] = { .max_mcs = 12, .flags.zn_regs_v2 = 1, .ops = { - .early_channel_count = f17_early_channel_count, .dbam_to_cs = f17_addr_mask_to_cs_size, } }, @@ -2961,7 +2866,6 @@ static struct amd64_family_type family_types[] = { .ctl_name = "F19h_M50h", .max_mcs = 2, .ops = { - .early_channel_count = f17_early_channel_count, .dbam_to_cs = f17_addr_mask_to_cs_size, } }, @@ -3620,7 +3524,7 @@ static int init_csrows(struct mem_ctl_info *mci) : EDAC_SECDED; } - for (j = 0; j < pvt->channel_count; j++) { + for (j = 0; j < fam_type->max_mcs; j++) { dimm = csrow->channels[j]->dimm; dimm->mtype = pvt->dram_type; dimm->edac_mode = edac_mode; @@ -4057,28 +3961,12 @@ static int init_one_instance(struct amd64_pvt *pvt) { struct mem_ctl_info *mci = NULL; struct edac_mc_layer layers[2]; - int ret = -EINVAL; + int ret = -ENOMEM; - /* - * 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. - */ - pvt->channel_count = pvt->ops->early_channel_count(pvt); - if (pvt->channel_count < 0) - return ret; - - ret = -ENOMEM; layers[0].type = EDAC_MC_LAYER_CHIP_SELECT; layers[0].size = pvt->csels[0].b_cnt; layers[0].is_virt_csrow = true; layers[1].type = EDAC_MC_LAYER_CHANNEL; - - /* - * 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. - */ layers[1].size = fam_type->max_mcs; layers[1].is_virt_csrow = false; diff --git a/drivers/edac/amd64_edac.h b/drivers/edac/amd64_edac.h index 398fb58dacbf..e4329dff8cf2 100644 --- a/drivers/edac/amd64_edac.h +++ b/drivers/edac/amd64_edac.h @@ -346,7 +346,6 @@ struct amd64_pvt { u8 stepping; /* ... stepping */ int ext_model; /* extended model value of this node */ - int channel_count; /* Raw registers */ u32 dclr0; /* DRAM Configuration Low DCT0 reg */ @@ -466,7 +465,6 @@ struct ecc_settings { * functions and per device encoding/decoding logic. */ struct low_ops { - int (*early_channel_count) (struct amd64_pvt *pvt); void (*map_sysaddr_to_csrow) (struct mem_ctl_info *mci, u64 sys_addr, struct err_info *); int (*dbam_to_cs) (struct amd64_pvt *pvt, u8 dct, From patchwork Fri Jan 27 17:04:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 13119073 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19541C38142 for ; Fri, 27 Jan 2023 17:06:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234913AbjA0RGf (ORCPT ); Fri, 27 Jan 2023 12:06:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235048AbjA0RGG (ORCPT ); Fri, 27 Jan 2023 12:06:06 -0500 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2044.outbound.protection.outlook.com [40.107.220.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7644A29156; Fri, 27 Jan 2023 09:05:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YvFPkkjdRHeqYZ/Mlo0+9e9d/4wRTO/mE+43ejOi9sMpg3jx/2dZwuA+mOfR+oBharU0GGBF74a4HRblt8kj8WxzfXIEN5zMZYp9mSKzXza4gpjpHGr57Id+xmDVNUPjWZiShP5X0om9/pr1h57GhQptfC0MsFiOTOTfpNiqzBVSJG1XuhvfyuJTgO8zW1VdeZlDXqPEUhUBajRlZdEsIarCYLwd5gd83Lu/XGesplb58wLtPbNr+m/Lo7zyYAGabxgkFcXaIxWdul/FSkuUrCbv88Y3M8E3hUiooiTwyJOL12CcSlq734ZkeeI3vtxExlgTkhrjQcJz5Jp64ierkQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=IbdYxXAzDlrlEDnsG0h1hntKMoMNbwjpAEEZgCD3alY=; b=PtuBr+JV1H/JUqibgqPSJwIO6LtJz39OsIQXw8jAY+gDXBte4/c9Bg3eIlRuZ3qlU6ny5E7gywakDw0w36OrhzgvTV0VNN0ppSp61EVp0IhDT7gN/BBm1TpwdUTlcLd6bMjBdDX1zCjQTuAtFtqT1yhf/zv4QSH0R1y3uc7b9VRC4rSeW7OL6Lm5HmeA8caLc3VYr4oAAR87DaaJ6rzTHbVY20/u7laKGCe1erHDbe0LzCUVJv0PuLWIIGHMWcDLS8TDZ9Rr3NBV+qJcs5FJM4nVyJzRTTT6rhEyVYEEAa1LRg5Xe1OzNh9TVmVJt36Kw8IJzP/kZmgRleSw3lEAVw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IbdYxXAzDlrlEDnsG0h1hntKMoMNbwjpAEEZgCD3alY=; b=xcUBRbkeFM5safMCfY6o3PS0omkVge5+SK+jkFrMiPH6ljl/DjmQR6or4+959MDq5Z8kPRe+EbkgKNxTWImHy+RO2LzbnPsSVt9YKTgHf/eVDu9j0YHedZdVg4jd/O0wLBGq8r0OAKXLLrwLASCLiz8y0jtHcXMdcHZj2ig4tDE= Received: from BN8PR04CA0045.namprd04.prod.outlook.com (2603:10b6:408:d4::19) by CH3PR12MB8283.namprd12.prod.outlook.com (2603:10b6:610:12a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.22; Fri, 27 Jan 2023 17:04:34 +0000 Received: from BN8NAM11FT089.eop-nam11.prod.protection.outlook.com (2603:10b6:408:d4:cafe::1f) by BN8PR04CA0045.outlook.office365.com (2603:10b6:408:d4::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.22 via Frontend Transport; Fri, 27 Jan 2023 17:04:34 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT089.mail.protection.outlook.com (10.13.176.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6023.16 via Frontend Transport; Fri, 27 Jan 2023 17:04:34 +0000 Received: from yaz-ethanolx.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 27 Jan 2023 11:04:32 -0600 From: Yazen Ghannam To: , CC: , , , Yazen Ghannam Subject: [PATCH v2 06/22] EDAC/amd64: Rename debug_display_dimm_sizes() Date: Fri, 27 Jan 2023 17:04:03 +0000 Message-ID: <20230127170419.1824692-7-yazen.ghannam@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230127170419.1824692-1-yazen.ghannam@amd.com> References: <20230127170419.1824692-1-yazen.ghannam@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT089:EE_|CH3PR12MB8283:EE_ X-MS-Office365-Filtering-Correlation-Id: 86e1a93e-3d32-42c8-ef8b-08db0088905c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xlVaUMLAfZ7mVB0tveNuOEk8jZFLYxIlsMc6HpBkxXK7whS/lY1qpmI41rcJldiC7ustVKKyW1tiq1y1pD19vYFBa2qfrmbaiZiJZro3UN1GDxK2K8+5/KYs71ICidbuvkBqm65aguVf6GqUIr7xMy8+r5zLTd/Qyqc3PM5g5wAtZrKtQy3842briQs6BCWmjayNmOnk/Ne13JNnTuc3ipjDU1qmxIg2Y+Mkp66X+JI4B8LVTxu350GSBz/kxyOuSjUCnxq0EH9CngAuIOteFtCZsRbojjApdNTIN6Y4il8wjzFUyeMAYGh+U/KSaVE2l5qwRffQdfLTsppGW4zVmYeTbrWJ+3oUjUGNDx/7xq7QheMUeuIp+MPrWlj+NicQaBpVz3D7iwXR43Do873nAgklhb7tq2m/GeFAwiVqfe67gNd3wESBMGmCSMphCXNS0vniG/DCzLDIVPKS/0PmbAZFmKyJ8YF3NypaTeGmGctg0HII6P7UNAytv/9h3J0FEV6fv5hwbeSx4tQc58ipRb0wU6znrzC+jR/ruRRE/Wxo9Dc49wrWu1rDJgBIq00dROG7sRGSfPaY1zpikrHde2IndPYsw1qw2RnXbYvfpOmWx+FMndHJbK20YMalqpAaEweIayJGMdvwZDekVe17WhUsiYHqnxDMWq4myH9kMlTQJH/QVSo7MTOy45n2daY01HW3uMJLFeDg0QnvNjtIz48Hxv57KhN2zt0JOVWTG668cvEUnFdW9SHVEbvWlamAn/ZNjSxnG08VlQr0NPwsQg== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230025)(4636009)(39860400002)(136003)(346002)(396003)(376002)(451199018)(46966006)(36840700001)(40470700004)(47076005)(8676002)(36756003)(40460700003)(7696005)(54906003)(40480700001)(356005)(336012)(16526019)(110136005)(81166007)(36860700001)(26005)(2616005)(83380400001)(86362001)(966005)(82310400005)(426003)(186003)(44832011)(6666004)(478600001)(316002)(1076003)(70586007)(82740400003)(8936002)(70206006)(41300700001)(5660300002)(4326008)(2906002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2023 17:04:34.0150 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 86e1a93e-3d32-42c8-ef8b-08db0088905c X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT089.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8283 Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org Use the "dct" and "umc" prefixes for legacy and modern versions respectively. Also, move the "dct" version to avoid a forward declaration, and fixup some checkpatch warnings in the process. Signed-off-by: Yazen Ghannam --- Link: https://lore.kernel.org/r/20220509145534.44912-1-yazen.ghannam@amd.com v1->v2: * New in v2. drivers/edac/amd64_edac.c | 128 +++++++++++++++++++------------------- 1 file changed, 63 insertions(+), 65 deletions(-) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 1c4bef1cdf28..2d0558aeca28 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -1291,7 +1291,65 @@ static unsigned long determine_edac_cap(struct amd64_pvt *pvt) return edac_cap; } -static void debug_display_dimm_sizes(struct amd64_pvt *, u8); +/* + * debug routine to display the memory sizes of all logical DIMMs and its + * CSROWs + */ +static void dct_debug_display_dimm_sizes(struct amd64_pvt *pvt, u8 ctrl) +{ + u32 *dcsb = ctrl ? pvt->csels[1].csbases : pvt->csels[0].csbases; + u32 dbam = ctrl ? pvt->dbam1 : pvt->dbam0; + int dimm, size0, size1; + + if (pvt->fam == 0xf) { + /* K8 families < revF not supported yet */ + if (pvt->ext_model < K8_REV_F) + return; + + WARN_ON(ctrl != 0); + } + + if (pvt->fam == 0x10) { + dbam = (ctrl && !dct_ganging_enabled(pvt)) ? pvt->dbam1 + : pvt->dbam0; + dcsb = (ctrl && !dct_ganging_enabled(pvt)) ? + pvt->csels[1].csbases : + pvt->csels[0].csbases; + } else if (ctrl) { + dbam = pvt->dbam0; + dcsb = pvt->csels[1].csbases; + } + edac_dbg(1, "F2x%d80 (DRAM Bank Address Mapping): 0x%08x\n", + ctrl, dbam); + + edac_printk(KERN_DEBUG, EDAC_MC, "DCT%d chip selects:\n", ctrl); + + /* Dump memory sizes for DIMM and its CSROWs */ + for (dimm = 0; dimm < 4; dimm++) { + size0 = 0; + if (dcsb[dimm * 2] & DCSB_CS_ENABLE) + /* + * For F15m60h, we need multiplier for LRDIMM cs_size + * calculation. We pass dimm value to the dbam_to_cs + * mapper so we can find the multiplier from the + * corresponding DCSM. + */ + size0 = pvt->ops->dbam_to_cs(pvt, ctrl, + DBAM_DIMM(dimm, dbam), + dimm); + + size1 = 0; + if (dcsb[dimm * 2 + 1] & DCSB_CS_ENABLE) + size1 = pvt->ops->dbam_to_cs(pvt, ctrl, + DBAM_DIMM(dimm, dbam), + dimm); + + amd64_info(EDAC_MC ": %d: %5dMB %d: %5dMB\n", + dimm * 2, size0, + dimm * 2 + 1, size1); + } +} + static void debug_dump_dramcfg_low(struct amd64_pvt *pvt, u32 dclr, int chan) { @@ -1366,7 +1424,7 @@ static int f17_get_cs_mode(int dimm, u8 ctrl, struct amd64_pvt *pvt) return cs_mode; } -static void debug_display_dimm_sizes_df(struct amd64_pvt *pvt, u8 ctrl) +static void umc_debug_display_dimm_sizes(struct amd64_pvt *pvt, u8 ctrl) { int dimm, size0, size1, cs0, cs1, cs_mode; @@ -1426,7 +1484,7 @@ static void __dump_misc_regs_df(struct amd64_pvt *pvt) i, 1 << ((tmp >> 4) & 0x3)); } - debug_display_dimm_sizes_df(pvt, i); + umc_debug_display_dimm_sizes(pvt, i); } } @@ -1451,13 +1509,13 @@ static void __dump_misc_regs(struct amd64_pvt *pvt) (pvt->fam == 0xf) ? k8_dhar_offset(pvt) : f10_dhar_offset(pvt)); - debug_display_dimm_sizes(pvt, 0); + dct_debug_display_dimm_sizes(pvt, 0); /* everything below this point is Fam10h and above */ if (pvt->fam == 0xf) return; - debug_display_dimm_sizes(pvt, 1); + dct_debug_display_dimm_sizes(pvt, 1); /* Only if NOT ganged does dclr1 have valid info */ if (!dct_ganging_enabled(pvt)) @@ -2681,66 +2739,6 @@ static void f1x_map_sysaddr_to_csrow(struct mem_ctl_info *mci, u64 sys_addr, err->channel = get_channel_from_ecc_syndrome(mci, err->syndrome); } -/* - * debug routine to display the memory sizes of all logical DIMMs and its - * CSROWs - */ -static void debug_display_dimm_sizes(struct amd64_pvt *pvt, u8 ctrl) -{ - int dimm, size0, size1; - u32 *dcsb = ctrl ? pvt->csels[1].csbases : pvt->csels[0].csbases; - u32 dbam = ctrl ? pvt->dbam1 : pvt->dbam0; - - if (pvt->fam == 0xf) { - /* K8 families < revF not supported yet */ - if (pvt->ext_model < K8_REV_F) - return; - else - WARN_ON(ctrl != 0); - } - - if (pvt->fam == 0x10) { - dbam = (ctrl && !dct_ganging_enabled(pvt)) ? pvt->dbam1 - : pvt->dbam0; - dcsb = (ctrl && !dct_ganging_enabled(pvt)) ? - pvt->csels[1].csbases : - pvt->csels[0].csbases; - } else if (ctrl) { - dbam = pvt->dbam0; - dcsb = pvt->csels[1].csbases; - } - edac_dbg(1, "F2x%d80 (DRAM Bank Address Mapping): 0x%08x\n", - ctrl, dbam); - - edac_printk(KERN_DEBUG, EDAC_MC, "DCT%d chip selects:\n", ctrl); - - /* Dump memory sizes for DIMM and its CSROWs */ - for (dimm = 0; dimm < 4; dimm++) { - - size0 = 0; - if (dcsb[dimm*2] & DCSB_CS_ENABLE) - /* - * For F15m60h, we need multiplier for LRDIMM cs_size - * calculation. We pass dimm value to the dbam_to_cs - * mapper so we can find the multiplier from the - * corresponding DCSM. - */ - size0 = pvt->ops->dbam_to_cs(pvt, ctrl, - DBAM_DIMM(dimm, dbam), - dimm); - - size1 = 0; - if (dcsb[dimm*2 + 1] & DCSB_CS_ENABLE) - size1 = pvt->ops->dbam_to_cs(pvt, ctrl, - DBAM_DIMM(dimm, dbam), - dimm); - - amd64_info(EDAC_MC ": %d: %5dMB %d: %5dMB\n", - dimm * 2, size0, - dimm * 2 + 1, size1); - } -} - static struct amd64_family_type family_types[] = { [K8_CPUS] = { .ctl_name = "K8", From patchwork Fri Jan 27 17:04:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 13119059 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9490DC54EAA for ; Fri, 27 Jan 2023 17:05:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231547AbjA0RF2 (ORCPT ); Fri, 27 Jan 2023 12:05:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234861AbjA0RFZ (ORCPT ); Fri, 27 Jan 2023 12:05:25 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on20610.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e88::610]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D66224C83; Fri, 27 Jan 2023 09:04:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AS/rckCalngyuwF+cki+zFC8cqP+LT+v4HnbEXL9iYg9U6oLA0sqki6kok0AOJPGEHzEhxXWRtwlrwYIwjqFfTEIan8ryG2Y4UnBIkhHy7afMOaPk+eInNoOcSgwInPvWEF+sUfl2sfTsmCBW7AApR2Xf/U0Mgf/8M6fC5KWphhSlf+rtnd/VjqF0VfQWnqUF17A4I4xgU1ownvAKf/GsRz0FTvTyrLcFanC3lw4emei2mSniiNRAg7SYEZhle3+2FAkuJMa6sN6KAxX0JZLkk+lUspGAZRIK+4iBIzTurGvNBJBTitGvep2Cg38K3X6w/AtWrJmNY9pfQHh72P9ag== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=FNL6Z+KjCS6wq6EclvAAUkPpSaXGXQpokOsEFJYeLng=; b=DjG3KyCTw4ufI5iSW1Ghc8xHe4RXTv3Zr51PCUY4EPe6pFiRo20UD02VpklyCaT+JBAOhAWCmAQjEp4YJxmQZwjTn90fqPHVuYtMaiPaPBirM1WJ/jHqAQdvoJo7iPBWkCW3GMgCezu0sAQmf/CXN9amkRcX7Qfz89Dz+Cp2RQYJnjbTW71Farmcn9+9YPiOem39MQAZR6phe4dO1b5YwYinBcK2r4+XLzU6Egs8D8juMyuuJ2c2Zg1PSAlU1QqFU5w4E3Yvy7zpTsOlDOjC3rtA5zc2ymTuZca/+iQTdgbwHxO9iUwqlI1Mt0++PVn4P3UuSlkTqiCsEHSbmhSWSQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FNL6Z+KjCS6wq6EclvAAUkPpSaXGXQpokOsEFJYeLng=; b=VcFuic7DiR2O29U5sUcJEd/AQfMZzSfxNvmCpx/Zq6zuMt/oZwZbS0aP13aJ2QLTOxv1NDHtOQhVYlrRW4+nAQ/Hom+ctOtzzPkdpEsd7WOoVClNRbommNqAhpMr6dF7R6gIsde/1X3wfiwmsJCjpaTEpPtEdZ9UMFlYhonutVc= Received: from BN8PR04CA0043.namprd04.prod.outlook.com (2603:10b6:408:d4::17) by SA3PR12MB7782.namprd12.prod.outlook.com (2603:10b6:806:31c::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.23; Fri, 27 Jan 2023 17:04:34 +0000 Received: from BN8NAM11FT089.eop-nam11.prod.protection.outlook.com (2603:10b6:408:d4:cafe::1f) by BN8PR04CA0043.outlook.office365.com (2603:10b6:408:d4::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.25 via Frontend Transport; Fri, 27 Jan 2023 17:04:34 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT089.mail.protection.outlook.com (10.13.176.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6023.16 via Frontend Transport; Fri, 27 Jan 2023 17:04:34 +0000 Received: from yaz-ethanolx.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 27 Jan 2023 11:04:33 -0600 From: Yazen Ghannam To: , CC: , , , Yazen Ghannam Subject: [PATCH v2 07/22] EDAC/amd64: Split get_csrow_nr_pages() into dct/umc functions Date: Fri, 27 Jan 2023 17:04:04 +0000 Message-ID: <20230127170419.1824692-8-yazen.ghannam@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230127170419.1824692-1-yazen.ghannam@amd.com> References: <20230127170419.1824692-1-yazen.ghannam@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT089:EE_|SA3PR12MB7782:EE_ X-MS-Office365-Filtering-Correlation-Id: 32616fba-b9bd-4893-144d-08db00889083 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: L6FYtmI6s+KbIDIkWPLReGPFJfFHVBJEfIVSglakAA/jpmtaLGf3gjZ6pHQpLG6M3GDy+sWDpqa88Ky2yZ/SB6b6K+66/31fBstB6KGQh3pXi6E8fI49EdJ85ysCrsQRZ71FAP85y210SyjL1M456PSVVrlZda7/UX5OPjfD+VZ1EkfCJ7EdD6fzImaKdUvDpkY0PlrWVA6f/0tWCvjRIQIwWGo/u8JME2ikCv7Pg2MV9X+TeWxbLiuSAavjgeui9ppNC3o8+/YYUDdWaCt9IuBqJRfxYK+oDFw8Mbg+LfxkoCcuvIemJeXQqNySAL/I8BywJPtABNXW5OVQlMbn/L4KbIAgTcB/Is1Y6KZivtq9aT3KJuHwrMhjIGOKQTzugjbL9OXS9sVou8YeaP7oFsUqQPYeHhzw/o3FnMF8uDFgbziwiQ+3xHQXlpp9ZrOL5x9MMSHbEfda1bTPbvdBCZl8ryIZMMIu9J/CeUSKVtL72OHJH3BdPYRUlldOuYMgn/DtBj7nKVVTMfo7M3A7JHIAJWqMcXz1xgoIj737wITtqcz9++RE7JAj/t3SJWCZMlXccEslnqAGKvd/wXMZGEWvEHPZLbfN8g1CDP4ESaKfaYbdWN2/Bpy2g9ccWrQ5Oul003VP6xB9aahYp8D7VztkNE1dyEXcKe13IAyuc+9FsxoOQ/Zx7Qb1FsZzFmkF2oRVH6nTAbXHzZzhvYSSF379RoFyoUlL0jtWvF83Xpc3wdrlyUw7Wy1G/u6Ly5bvTJnBmIPuUFyx5aSI4YxaYQ== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230025)(4636009)(346002)(39860400002)(396003)(136003)(376002)(451199018)(40470700004)(46966006)(36840700001)(36756003)(40460700003)(82310400005)(966005)(478600001)(2906002)(7696005)(26005)(186003)(16526019)(6666004)(41300700001)(1076003)(8936002)(8676002)(4326008)(70206006)(70586007)(44832011)(316002)(54906003)(5660300002)(110136005)(86362001)(82740400003)(40480700001)(81166007)(426003)(356005)(47076005)(2616005)(36860700001)(83380400001)(336012)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2023 17:04:34.2650 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 32616fba-b9bd-4893-144d-08db00889083 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT089.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB7782 Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org Split get_csrow_nr_pages() into a legacy and modern versions in preparation for further legacy/modern refactoring. Also, rename f17_get_cs_mode() to match the new convention. Signed-off-by: Yazen Ghannam --- Link: https://lore.kernel.org/r/20220509145534.44912-1-yazen.ghannam@amd.com v1->v2: * New in v2. drivers/edac/amd64_edac.c | 40 +++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 2d0558aeca28..5559d05fb15d 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -1392,7 +1392,7 @@ static void debug_dump_dramcfg_low(struct amd64_pvt *pvt, u32 dclr, int chan) #define CS_EVEN (CS_EVEN_PRIMARY | CS_EVEN_SECONDARY) #define CS_ODD (CS_ODD_PRIMARY | CS_ODD_SECONDARY) -static int f17_get_cs_mode(int dimm, u8 ctrl, struct amd64_pvt *pvt) +static int umc_get_cs_mode(int dimm, u8 ctrl, struct amd64_pvt *pvt) { u8 base, count = 0; int cs_mode = 0; @@ -1434,7 +1434,7 @@ static void umc_debug_display_dimm_sizes(struct amd64_pvt *pvt, u8 ctrl) cs0 = dimm * 2; cs1 = dimm * 2 + 1; - cs_mode = f17_get_cs_mode(dimm, ctrl, pvt); + cs_mode = umc_get_cs_mode(dimm, ctrl, pvt); size0 = pvt->ops->dbam_to_cs(pvt, ctrl, cs_mode, cs0); size1 = pvt->ops->dbam_to_cs(pvt, ctrl, cs_mode, cs1); @@ -3389,24 +3389,36 @@ static void read_mc_regs(struct amd64_pvt *pvt) * encompasses * */ -static u32 get_csrow_nr_pages(struct amd64_pvt *pvt, u8 dct, int csrow_nr_orig) +static u32 dct_get_csrow_nr_pages(struct amd64_pvt *pvt, u8 dct, int csrow_nr) { u32 dbam = dct ? pvt->dbam1 : pvt->dbam0; - int csrow_nr = csrow_nr_orig; u32 cs_mode, nr_pages; - if (!pvt->umc) { - csrow_nr >>= 1; - cs_mode = DBAM_DIMM(csrow_nr, dbam); - } else { - cs_mode = f17_get_cs_mode(csrow_nr >> 1, dct, pvt); - } + csrow_nr >>= 1; + cs_mode = DBAM_DIMM(csrow_nr, dbam); nr_pages = pvt->ops->dbam_to_cs(pvt, dct, cs_mode, csrow_nr); nr_pages <<= 20 - PAGE_SHIFT; edac_dbg(0, "csrow: %d, channel: %d, DBAM idx: %d\n", - csrow_nr_orig, dct, cs_mode); + csrow_nr, dct, cs_mode); + edac_dbg(0, "nr_pages/channel: %u\n", nr_pages); + + return nr_pages; +} + +static u32 umc_get_csrow_nr_pages(struct amd64_pvt *pvt, u8 dct, int csrow_nr_orig) +{ + int csrow_nr = csrow_nr_orig; + u32 cs_mode, nr_pages; + + cs_mode = umc_get_cs_mode(csrow_nr >> 1, dct, pvt); + + nr_pages = pvt->ops->dbam_to_cs(pvt, dct, cs_mode, csrow_nr); + nr_pages <<= 20 - PAGE_SHIFT; + + edac_dbg(0, "csrow: %d, channel: %d, cs_mode %d\n", + csrow_nr_orig, dct, cs_mode); edac_dbg(0, "nr_pages/channel: %u\n", nr_pages); return nr_pages; @@ -3445,7 +3457,7 @@ static int init_csrows_df(struct mem_ctl_info *mci) edac_dbg(1, "MC node: %d, csrow: %d\n", pvt->mc_node_id, cs); - dimm->nr_pages = get_csrow_nr_pages(pvt, umc, cs); + dimm->nr_pages = umc_get_csrow_nr_pages(pvt, umc, cs); dimm->mtype = pvt->umc[umc].dram_type; dimm->edac_mode = edac_mode; dimm->dtype = dev_type; @@ -3501,13 +3513,13 @@ static int init_csrows(struct mem_ctl_info *mci) pvt->mc_node_id, i); if (row_dct0) { - nr_pages = get_csrow_nr_pages(pvt, 0, i); + nr_pages = dct_get_csrow_nr_pages(pvt, 0, i); csrow->channels[0]->dimm->nr_pages = nr_pages; } /* K8 has only one DCT */ if (pvt->fam != 0xf && row_dct1) { - int row_dct1_pages = get_csrow_nr_pages(pvt, 1, i); + int row_dct1_pages = dct_get_csrow_nr_pages(pvt, 1, i); csrow->channels[1]->dimm->nr_pages = row_dct1_pages; nr_pages += row_dct1_pages; From patchwork Fri Jan 27 17:04:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 13119074 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7642AC61DB3 for ; Fri, 27 Jan 2023 17:06:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235057AbjA0RGh (ORCPT ); Fri, 27 Jan 2023 12:06:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234963AbjA0RGI (ORCPT ); Fri, 27 Jan 2023 12:06:08 -0500 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2085.outbound.protection.outlook.com [40.107.220.85]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D262E87582; Fri, 27 Jan 2023 09:05:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=A19N7I/XcdqSfslUlZsMtkyAqzSDm3KNoA8BOq+g67p6OfXgHkyCgBLIp3g1ENSig+NF6nIeSilFZxM9TvP+6Wg08LMn23L6ej2IvX6he1t8dpLFmvtRWCXTwZnG2aqiYWA7J0gxtCPJaagEwiPZsgxu//HJUJ3t4lMrBIl4T+NubkUXmbVN23HTHBQGWg9G6M8H1WMxPky2eI9gWnYlCOssvdDntIuJu20iEaDmnj9OO9KkG93jPweC8KyYWOdwQgN9CvnooSxHgGZDHZ5USI/IlCUgbBUPLsgX64kQsKALU2wqMk2YOOWModpZLkMoQqwx1msgPQiZt0kRT9GAlA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=pyQcYouHdbkYxVmnWVf4bfpZyxggGJAnG8xab3mJHmU=; b=ZYrDvi0QzKmxUU3bVx731bL4zUiZ1jNQ5XIxksWltO7ItpRDa7HStcE5KdVNVodFbDOwsKfCAtG4CMevwV9TpnGez+Ik6F/RDYb4wmngxWa7o3f1YNPLVY73aTv/69aWlRghVGYpLTGDxpEKLwR68dWyfvmcBTXWqs9M8zwH0yyOQJgZhiEYRynLfSlUg5XpVFS4G+DGZMuRGt+S6aa+EBXzJVgr0ZiqU3SMV4Cwi6EovzXybbEP+Zc62h7WhGoyCQ9j828AEKScuCIw0+8r0kgC+aakm1vUIb/uJsNEcWx7r9R+XC7wXnLfNAFePw7SruyjeLtjbD/IGPagFds4+w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pyQcYouHdbkYxVmnWVf4bfpZyxggGJAnG8xab3mJHmU=; b=N2e9fOK8C3srb/L/RPYOHId8Jw44kSgsNIIj9sg8Oj6h0V0r6wrM9mZxQAh9f5gJrn3GH+xzQNKbJTFIxUBwK97JOf8xoeBAl/CjLRNn7mdl3CuNMSzCUknbYoOhLVAESoJrSIwyH000ptzfzvAhvIf70rcp8RFk/qF98cmhSt8= Received: from BN8PR04CA0052.namprd04.prod.outlook.com (2603:10b6:408:d4::26) by SJ0PR12MB6805.namprd12.prod.outlook.com (2603:10b6:a03:44f::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.25; Fri, 27 Jan 2023 17:04:35 +0000 Received: from BN8NAM11FT089.eop-nam11.prod.protection.outlook.com (2603:10b6:408:d4:cafe::88) by BN8PR04CA0052.outlook.office365.com (2603:10b6:408:d4::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.23 via Frontend Transport; Fri, 27 Jan 2023 17:04:34 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT089.mail.protection.outlook.com (10.13.176.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6023.16 via Frontend Transport; Fri, 27 Jan 2023 17:04:34 +0000 Received: from yaz-ethanolx.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 27 Jan 2023 11:04:33 -0600 From: Yazen Ghannam To: , CC: , , , Yazen Ghannam Subject: [PATCH v2 08/22] EDAC/amd64: Drop dbam_to_cs() for Family 17h and later Date: Fri, 27 Jan 2023 17:04:05 +0000 Message-ID: <20230127170419.1824692-9-yazen.ghannam@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230127170419.1824692-1-yazen.ghannam@amd.com> References: <20230127170419.1824692-1-yazen.ghannam@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT089:EE_|SJ0PR12MB6805:EE_ X-MS-Office365-Filtering-Correlation-Id: 256547a2-4cb3-4fbf-9950-08db008890ca X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6I2sXXdmMSbJOdnezU0BMG0ON7EwK3a6Xmpy7vm9kt62MGcnON3utmrd16kyaM7Qv/Bk60O4WUhz5b2h6rJ+VEnC60720I3+mKldO6ORMKAyrxkAtDZVef976L5ZrVhx/SheXEzEb82CznTTaGFZpP+elQxaBySBMmITc8oisJ0TsDoIvBrKnvFMe8P1034MtdJA3Dqg3Ubk7N9CW34IZEP9fFuMGqkVGeBIYwpry2/mBpNVqQUEDoXPGjBrUcdRk4fdU1XQZudQtoyOMLN+Bmqs5pPBh6wAKFMYZofEdy8BFnx90gPPvjF26ffgQhih+W8++r/F8/VEzmd0Z2n3Lwv0XTrgKsiXMyjqBCKtFGM5Ok8tVx1BBiBlzlajlxT2FHhRcy1nXRLfw4G3xN7WRbgkononKG0dFUktEXeD1+pyvjQgF8UaL0Gq7ltIF4bIiRAYxWiYRMW7x/u6kM1rDYxWRA3YXrFn06g3TmN72gZdq3JfIgQ+mujC8H+oAkd63hF0glVCPkzFgY5isyjTwZ2U8oUHRVVVmKB/xcUR+g/DpSJpUVEytexEXaMVR6nii2Q9QW8keS7hYJ8+E3dijyu7qZIKqeN1L5F3gZOD3TAvP5bYNrK7v6W4d9rfY4NzF5K+BgArpcauD8adFYvYFt1MHeXCi+dAycbGpgXmSU+klEQr/y+m21y1C9D61LrxTwvziVFHzLk955T62imMdyrb0zjIX+iRc1ImJyCvdY8MNzmrKPZVmwQ2D3IgN5MQOtMh6ViU95lq3yRpvvMudg== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230025)(4636009)(376002)(39860400002)(396003)(136003)(346002)(451199018)(46966006)(36840700001)(40470700004)(426003)(47076005)(336012)(2906002)(44832011)(36756003)(966005)(7696005)(316002)(478600001)(110136005)(54906003)(40460700003)(26005)(81166007)(70206006)(1076003)(356005)(8676002)(6666004)(70586007)(2616005)(83380400001)(4326008)(8936002)(40480700001)(5660300002)(41300700001)(86362001)(36860700001)(16526019)(186003)(82740400003)(82310400005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2023 17:04:34.7337 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 256547a2-4cb3-4fbf-9950-08db008890ca X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT089.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB6805 Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org The same function is used to calculate chip select size for all Zen-based family/models. Therefore, a family/model function pointer is not necessary. Drop the dbam_to_cs() function pointer for Family 17h and later systems. Also, move the Family 17h function to avoid a forward declaration. Rename it to indicate that the UMC Address Mask is used rather than the legacy DBAM value. Signed-off-by: Yazen Ghannam --- Link: https://lore.kernel.org/r/20220509145534.44912-1-yazen.ghannam@amd.com v1->v2: * New in v2. drivers/edac/amd64_edac.c | 186 +++++++++++++++++--------------------- 1 file changed, 81 insertions(+), 105 deletions(-) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 5559d05fb15d..e13fe400bad5 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -1424,6 +1424,84 @@ static int umc_get_cs_mode(int dimm, u8 ctrl, struct amd64_pvt *pvt) return cs_mode; } +static int umc_addr_mask_to_cs_size(struct amd64_pvt *pvt, u8 umc, + unsigned int cs_mode, int csrow_nr) +{ + u32 addr_mask_orig, addr_mask_deinterleaved; + u32 msb, weight, num_zero_bits; + int cs_mask_nr = csrow_nr; + int dimm, size = 0; + + /* No Chip Selects are enabled. */ + if (!cs_mode) + return size; + + /* Requested size of an even CS but none are enabled. */ + if (!(cs_mode & CS_EVEN) && !(csrow_nr & 1)) + return size; + + /* Requested size of an odd CS but none are enabled. */ + if (!(cs_mode & CS_ODD) && (csrow_nr & 1)) + return size; + + /* + * Family 17h introduced systems with one mask per DIMM, + * and two Chip Selects per DIMM. + * + * CS0 and CS1 -> MASK0 / DIMM0 + * CS2 and CS3 -> MASK1 / DIMM1 + * + * Family 19h Model 10h introduced systems with one mask per Chip Select, + * and two Chip Selects per DIMM. + * + * CS0 -> MASK0 -> DIMM0 + * CS1 -> MASK1 -> DIMM0 + * CS2 -> MASK2 -> DIMM1 + * CS3 -> MASK3 -> DIMM1 + * + * Keep the mask number equal to the Chip Select number for newer systems, + * and shift the mask number for older systems. + */ + dimm = csrow_nr >> 1; + + if (!fam_type->flags.zn_regs_v2) + cs_mask_nr >>= 1; + + /* Asymmetric dual-rank DIMM support. */ + if ((csrow_nr & 1) && (cs_mode & CS_ODD_SECONDARY)) + addr_mask_orig = pvt->csels[umc].csmasks_sec[cs_mask_nr]; + else + addr_mask_orig = pvt->csels[umc].csmasks[cs_mask_nr]; + + /* + * The number of zero bits in the mask is equal to the number of bits + * in a full mask minus the number of bits in the current mask. + * + * The MSB is the number of bits in the full mask because BIT[0] is + * always 0. + * + * In the special 3 Rank interleaving case, a single bit is flipped + * without swapping with the most significant bit. This can be handled + * by keeping the MSB where it is and ignoring the single zero bit. + */ + msb = fls(addr_mask_orig) - 1; + weight = hweight_long(addr_mask_orig); + num_zero_bits = msb - weight - !!(cs_mode & CS_3R_INTERLEAVE); + + /* Take the number of zero bits off from the top of the mask. */ + addr_mask_deinterleaved = GENMASK_ULL(msb - num_zero_bits, 1); + + edac_dbg(1, "CS%d DIMM%d AddrMasks:\n", csrow_nr, dimm); + edac_dbg(1, " Original AddrMask: 0x%x\n", addr_mask_orig); + edac_dbg(1, " Deinterleaved AddrMask: 0x%x\n", addr_mask_deinterleaved); + + /* Register [31:1] = Address [39:9]. Size is in kBs here. */ + size = (addr_mask_deinterleaved >> 2) + 1; + + /* Return size in MBs. */ + return size >> 10; +} + static void umc_debug_display_dimm_sizes(struct amd64_pvt *pvt, u8 ctrl) { int dimm, size0, size1, cs0, cs1, cs_mode; @@ -1436,8 +1514,8 @@ static void umc_debug_display_dimm_sizes(struct amd64_pvt *pvt, u8 ctrl) cs_mode = umc_get_cs_mode(dimm, ctrl, pvt); - size0 = pvt->ops->dbam_to_cs(pvt, ctrl, cs_mode, cs0); - size1 = pvt->ops->dbam_to_cs(pvt, ctrl, cs_mode, cs1); + size0 = umc_addr_mask_to_cs_size(pvt, ctrl, cs_mode, cs0); + size1 = umc_addr_mask_to_cs_size(pvt, ctrl, cs_mode, cs1); amd64_info(EDAC_MC ": %d: %5dMB %d: %5dMB\n", cs0, size0, @@ -2139,84 +2217,6 @@ static int f16_dbam_to_chip_select(struct amd64_pvt *pvt, u8 dct, return ddr3_cs_size(cs_mode, false); } -static int f17_addr_mask_to_cs_size(struct amd64_pvt *pvt, u8 umc, - unsigned int cs_mode, int csrow_nr) -{ - u32 addr_mask_orig, addr_mask_deinterleaved; - u32 msb, weight, num_zero_bits; - int cs_mask_nr = csrow_nr; - int dimm, size = 0; - - /* No Chip Selects are enabled. */ - if (!cs_mode) - return size; - - /* Requested size of an even CS but none are enabled. */ - if (!(cs_mode & CS_EVEN) && !(csrow_nr & 1)) - return size; - - /* Requested size of an odd CS but none are enabled. */ - if (!(cs_mode & CS_ODD) && (csrow_nr & 1)) - return size; - - /* - * Family 17h introduced systems with one mask per DIMM, - * and two Chip Selects per DIMM. - * - * CS0 and CS1 -> MASK0 / DIMM0 - * CS2 and CS3 -> MASK1 / DIMM1 - * - * Family 19h Model 10h introduced systems with one mask per Chip Select, - * and two Chip Selects per DIMM. - * - * CS0 -> MASK0 -> DIMM0 - * CS1 -> MASK1 -> DIMM0 - * CS2 -> MASK2 -> DIMM1 - * CS3 -> MASK3 -> DIMM1 - * - * Keep the mask number equal to the Chip Select number for newer systems, - * and shift the mask number for older systems. - */ - dimm = csrow_nr >> 1; - - if (!fam_type->flags.zn_regs_v2) - cs_mask_nr >>= 1; - - /* Asymmetric dual-rank DIMM support. */ - if ((csrow_nr & 1) && (cs_mode & CS_ODD_SECONDARY)) - addr_mask_orig = pvt->csels[umc].csmasks_sec[cs_mask_nr]; - else - addr_mask_orig = pvt->csels[umc].csmasks[cs_mask_nr]; - - /* - * The number of zero bits in the mask is equal to the number of bits - * in a full mask minus the number of bits in the current mask. - * - * The MSB is the number of bits in the full mask because BIT[0] is - * always 0. - * - * In the special 3 Rank interleaving case, a single bit is flipped - * without swapping with the most significant bit. This can be handled - * by keeping the MSB where it is and ignoring the single zero bit. - */ - msb = fls(addr_mask_orig) - 1; - weight = hweight_long(addr_mask_orig); - num_zero_bits = msb - weight - !!(cs_mode & CS_3R_INTERLEAVE); - - /* Take the number of zero bits off from the top of the mask. */ - addr_mask_deinterleaved = GENMASK_ULL(msb - num_zero_bits, 1); - - edac_dbg(1, "CS%d DIMM%d AddrMasks:\n", csrow_nr, dimm); - edac_dbg(1, " Original AddrMask: 0x%x\n", addr_mask_orig); - edac_dbg(1, " Deinterleaved AddrMask: 0x%x\n", addr_mask_deinterleaved); - - /* Register [31:1] = Address [39:9]. Size is in kBs here. */ - size = (addr_mask_deinterleaved >> 2) + 1; - - /* Return size in MBs. */ - return size >> 10; -} - static void read_dram_ctl_register(struct amd64_pvt *pvt) { @@ -2813,59 +2813,35 @@ static struct amd64_family_type family_types[] = { [F17_CPUS] = { .ctl_name = "F17h", .max_mcs = 2, - .ops = { - .dbam_to_cs = f17_addr_mask_to_cs_size, - } }, [F17_M10H_CPUS] = { .ctl_name = "F17h_M10h", .max_mcs = 2, - .ops = { - .dbam_to_cs = f17_addr_mask_to_cs_size, - } }, [F17_M30H_CPUS] = { .ctl_name = "F17h_M30h", .max_mcs = 8, - .ops = { - .dbam_to_cs = f17_addr_mask_to_cs_size, - } }, [F17_M60H_CPUS] = { .ctl_name = "F17h_M60h", .max_mcs = 2, - .ops = { - .dbam_to_cs = f17_addr_mask_to_cs_size, - } }, [F17_M70H_CPUS] = { .ctl_name = "F17h_M70h", .max_mcs = 2, - .ops = { - .dbam_to_cs = f17_addr_mask_to_cs_size, - } }, [F19_CPUS] = { .ctl_name = "F19h", .max_mcs = 8, - .ops = { - .dbam_to_cs = f17_addr_mask_to_cs_size, - } }, [F19_M10H_CPUS] = { .ctl_name = "F19h_M10h", .max_mcs = 12, .flags.zn_regs_v2 = 1, - .ops = { - .dbam_to_cs = f17_addr_mask_to_cs_size, - } }, [F19_M50H_CPUS] = { .ctl_name = "F19h_M50h", .max_mcs = 2, - .ops = { - .dbam_to_cs = f17_addr_mask_to_cs_size, - } }, }; @@ -3414,7 +3390,7 @@ static u32 umc_get_csrow_nr_pages(struct amd64_pvt *pvt, u8 dct, int csrow_nr_or cs_mode = umc_get_cs_mode(csrow_nr >> 1, dct, pvt); - nr_pages = pvt->ops->dbam_to_cs(pvt, dct, cs_mode, csrow_nr); + nr_pages = umc_addr_mask_to_cs_size(pvt, dct, cs_mode, csrow_nr); nr_pages <<= 20 - PAGE_SHIFT; edac_dbg(0, "csrow: %d, channel: %d, cs_mode %d\n", From patchwork Fri Jan 27 17:04:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 13119061 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4EE7CC38142 for ; Fri, 27 Jan 2023 17:05:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234687AbjA0RFa (ORCPT ); Fri, 27 Jan 2023 12:05:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234825AbjA0RF3 (ORCPT ); Fri, 27 Jan 2023 12:05:29 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2062d.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e88::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 984C7144A8; Fri, 27 Jan 2023 09:04:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DcMdcS1v8JvcJFcnkngxFzwXIlL6bRbmGE++bDiwKe3q/hm/CoGdyZ0sCGo1mmYbXLJe0lKggXFxbr4bpTJE5+6rRKWdYFPcGis52h6b61bq7PHWusLGeQYAhylugil7dg7NnCyq80jg7LfK03PpwfFHTrhfHCOBpmtMQk0uXHdJfNPCm+TzTdOToFXJ5NzIlYgkHFOppfqyTqsj9mToSQ1pg4A7O3HfGOvrV4Lxvej9p7497B8sqwESQpHgNXcPpTX390//hxmyySBhK/ufvbGBbBQMhoh7CVRJGUPXMYb4BTK4Zt5pNFD6amkM+h44UQyYIDxWEQ9iKHX3JHzH9Q== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=hqfDyt7MfWXaSyKocltOflslxdf/hgjpUusQrjhCL+g=; b=NvBd/jkPW56FfRg3XYwZ+i0wDBdGgKw4INhoXv7r73mRU9y50Hf8nPlogaSHQfjP21hbz53xAOX0TKL73qPQ1b3rJPFKRyHzibyNsbrT0zqFad40xl3vTmD0I/L3zatLRTtWgignLMaBNg6zgsEgVIHgxb4SV5D1SkI+JWcXKYno2Pti6JJ42uhEmsR3Jnsp6COU4CgvUG4Gx0mWKd/TajSr+Vw41ArgZ+QJJ/71QUGTnZCdIs6UDCx3y/qKayav6R2MYSpyQ1My8Kv5Bbvypr+YeGfU4vuXgXHgFWRkJNz395ebjAdEbWEHM9rK3ei3yLk8CEuEOYrntebRodXFMw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hqfDyt7MfWXaSyKocltOflslxdf/hgjpUusQrjhCL+g=; b=My2dD4otBwn8KZyiDVbPiBKKMcsUzWdx+GWbXzjxmAFuv14cCBXtTe4Wn3mQP6iaJkNKfkVc/eYsOI6n96pb+9mHq50AI21trzuvLGW17e5ckS0q2AJcJ9JEyPt4tkko2lWErBzu8FA+C+AgdZdL9UrNUu+acdzF0ZZo4u14a5c= Received: from BN9PR03CA0480.namprd03.prod.outlook.com (2603:10b6:408:139::35) by CH0PR12MB5299.namprd12.prod.outlook.com (2603:10b6:610:d6::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.25; Fri, 27 Jan 2023 17:04:36 +0000 Received: from BN8NAM11FT016.eop-nam11.prod.protection.outlook.com (2603:10b6:408:139:cafe::27) by BN9PR03CA0480.outlook.office365.com (2603:10b6:408:139::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.23 via Frontend Transport; Fri, 27 Jan 2023 17:04:36 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT016.mail.protection.outlook.com (10.13.176.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6043.23 via Frontend Transport; Fri, 27 Jan 2023 17:04:35 +0000 Received: from yaz-ethanolx.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 27 Jan 2023 11:04:33 -0600 From: Yazen Ghannam To: , CC: , , , Yazen Ghannam Subject: [PATCH v2 09/22] EDAC/amd64: Don't find ECC symbol size for Family 17h and later Date: Fri, 27 Jan 2023 17:04:06 +0000 Message-ID: <20230127170419.1824692-10-yazen.ghannam@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230127170419.1824692-1-yazen.ghannam@amd.com> References: <20230127170419.1824692-1-yazen.ghannam@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT016:EE_|CH0PR12MB5299:EE_ X-MS-Office365-Filtering-Correlation-Id: b4e3eca4-691b-413d-9437-08db00889125 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: elrb2NdNWaBQSvCiQc3qNDPgG9C1cOhrIl36I8fUNo13ynvh2us90Dl4OUkoxwtkpLMWHI4EnI5W/1+LOTRiwHXvMH+vjgL7LOEj++ai4PkgpNN9iyg34h/Iwbgtm6bnohd11/Vx++F1Pt6SatdmgGIL6JLU+2KKEw/eEmWcQUkj/wifm8N/+1tWAfwckHBkW2HKpmxpS0IGSgPT6Hj+VRvcIRCTqUZ5p0/lS5cLpRGmtIgmtQOiJ/uPekhZ/2uAyeMdtCaCnl0nLkyG8aBhmdhS0fz2l93Zma4MbWt2uc8vKG7l4/eSzJQwJrQPocaEpxvZuHznaG5MqEFkbwLU2UjfU6b71RVDUPwedS92pns1oAruettYyHqrgQraLiOweHGmFKoBrMWNhdcjQGjjdylALrkEKbsXsyF/PYkN700vLLs2YJpb3RXVY5vZ6YM01FiW9MQDF8jNzUX70trnJDlZHgiTWzaq2jsbq01qyNRYWe20cFaGvtFZhge79Gzy6rJhbsQZV620pZScwcqr4GwP/Hb5tinTNXD5SOm9W/Mjw09q03fE4QJRs21NlT39U/dK8AR5aAUUOm/Ne6zZp8PULweJ2yBYH2TE4mcNTIeoVYGDUkXYHLumG+JSWwtHXdQX4CLn4IB6idZq7voJxTZWNUwhoEe7e3ZlUM3lVSlRLMcOHDKiwPMHaJSUk+5JOvfeU1qCdbr8naCRIgEvUre8kk0MSib0MxqXMoeLWpx8QzTc3dlMyje6pTdPWF6+5pae7JKkMhoEUk8yjpITWg== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230025)(4636009)(376002)(136003)(396003)(346002)(39860400002)(451199018)(36840700001)(46966006)(40470700004)(186003)(26005)(336012)(16526019)(6666004)(1076003)(7696005)(2616005)(966005)(316002)(54906003)(47076005)(110136005)(426003)(2906002)(4326008)(41300700001)(83380400001)(8676002)(70206006)(70586007)(478600001)(36860700001)(5660300002)(44832011)(8936002)(82740400003)(36756003)(40480700001)(81166007)(356005)(86362001)(82310400005)(40460700003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2023 17:04:35.3299 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b4e3eca4-691b-413d-9437-08db00889125 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT016.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB5299 Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org The ECC symbol size was needed on legacy system to lookup the ECC syndrome. This is not needed on modern systems because the ECC syndrome is explicitly provided in the MCA information. Remove the ECC symbol size discovery code for modern UMC-based systems. Signed-off-by: Yazen Ghannam --- Link: https://lore.kernel.org/r/20220509145534.44912-10-yazen.ghannam@amd.com v1->v2: * New in v2. * Replaces v1 patch 9. drivers/edac/amd64_edac.c | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index e13fe400bad5..1d5c2c97d563 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -1600,6 +1600,8 @@ static void __dump_misc_regs(struct amd64_pvt *pvt) debug_dump_dramcfg_low(pvt, pvt->dclr1, 1); edac_dbg(1, " DramHoleValid: %s\n", dhar_valid(pvt) ? "yes" : "no"); + + amd64_info("using x%u syndromes.\n", pvt->ecc_sym_sz); } /* Display and decode various NB registers for debug purposes. */ @@ -1609,8 +1611,6 @@ static void dump_misc_regs(struct amd64_pvt *pvt) __dump_misc_regs_df(pvt); else __dump_misc_regs(pvt); - - amd64_info("using x%u syndromes.\n", pvt->ecc_sym_sz); } /* @@ -3197,22 +3197,7 @@ static void determine_ecc_sym_sz(struct amd64_pvt *pvt) { pvt->ecc_sym_sz = 4; - if (pvt->umc) { - u8 i; - - for_each_umc(i) { - /* Check enabled channels only: */ - if (pvt->umc[i].sdp_ctrl & UMC_SDP_INIT) { - if (pvt->umc[i].ecc_ctrl & BIT(9)) { - pvt->ecc_sym_sz = 16; - return; - } else if (pvt->umc[i].ecc_ctrl & BIT(7)) { - pvt->ecc_sym_sz = 8; - return; - } - } - } - } else if (pvt->fam >= 0x10) { + if (pvt->fam >= 0x10) { u32 tmp; amd64_read_pci_cfg(pvt->F3, EXT_NB_MCA_CFG, &tmp); From patchwork Fri Jan 27 17:04:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 13119076 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10128C38142 for ; Fri, 27 Jan 2023 17:06:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234978AbjA0RGh (ORCPT ); Fri, 27 Jan 2023 12:06:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235059AbjA0RGN (ORCPT ); Fri, 27 Jan 2023 12:06:13 -0500 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2041.outbound.protection.outlook.com [40.107.237.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04C7286626; Fri, 27 Jan 2023 09:05:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Tm1P2uq2RiFtnZPTIMPwDmffvcc9MlVDOuQuYMo0KSRgaXvYNgSgH2k2BnYNZoRrFOJtpQqDT5mnCbM+skP9knUwsB6ZwY8GMCnapHYhQVE9VQAAz0+JZxt6MGjBTUnXUY1ZeUd57zC9/yu8e7kOq8CRO/q+w5XbJ/dUnAXBQ7onhl8IN0HbI+jFx/HX586E4a/fTsb3LbZ7hl3OVz2vn/O/s4BgdwWj18tFhjOiAyMCwAmd3tmen1sDarhTrR3TSn1jzBwX30GcYdePGFrHgUdAPE3MUCPklaD869lM+fcrmPFTFq6mqUZVYKr9lyc/IF0WJ4qmDlNH2qDynPV7uw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=mznSDyF/o/9gP2rhctBMKkk4XOn5d/N1x2XbuK7VV4s=; b=jzcgZfgqy69EtwFmra+qUMcnrtroMuCDs8pZAwFu21t3ACJE4igJ2oRYT9XmcRVQe3y9vxwWi8tQB8cGswhyqt/UWpb0yO8pJ83cthMoQhIr8yMo4p76DNalPY6kerXjIBZ925Ihj/axaLou+6lEqvigi6NRz5jvXRKcbedb08C6UXWgE9eZ+mkOwx6t7Vyx1Wy8WDQV7l34yQkPeT/m0Jgh5Y0iRfnBHq9mgyurVWthi+rZEQZsvhbgj9kLfxEdnIsM3wvMk/sTnAVklHTrmjjBVi8vxXE4fN8oL6koX0pJ+xKX2KYqPzvRHshilRNeGVhahJxYm460tvKnVhjsaA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mznSDyF/o/9gP2rhctBMKkk4XOn5d/N1x2XbuK7VV4s=; b=a+cj8g2pbbj0l7wrOM25FvmxrG2r398ftyI3eKgNLny186STK0Lw9mt2cH4RqJLT0/yCMmr7/ZfSDxf+gJ7AhVmea9hG3lwCKbbpPu8MjZDhWlshrD04aNlVj+N/V085rMOrHRDognvSXSMJj3G6422qUSbltlS/1InSQMTBNNQ= Received: from BN8PR04CA0037.namprd04.prod.outlook.com (2603:10b6:408:d4::11) by SA1PR12MB6701.namprd12.prod.outlook.com (2603:10b6:806:251::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.33; Fri, 27 Jan 2023 17:04:36 +0000 Received: from BN8NAM11FT089.eop-nam11.prod.protection.outlook.com (2603:10b6:408:d4:cafe::e3) by BN8PR04CA0037.outlook.office365.com (2603:10b6:408:d4::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.23 via Frontend Transport; Fri, 27 Jan 2023 17:04:36 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT089.mail.protection.outlook.com (10.13.176.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6023.16 via Frontend Transport; Fri, 27 Jan 2023 17:04:36 +0000 Received: from yaz-ethanolx.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 27 Jan 2023 11:04:34 -0600 From: Yazen Ghannam To: , CC: , , , Yazen Ghannam Subject: [PATCH v2 10/22] EDAC/amd64: Merge struct amd64_family_type into struct amd64_pvt Date: Fri, 27 Jan 2023 17:04:07 +0000 Message-ID: <20230127170419.1824692-11-yazen.ghannam@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230127170419.1824692-1-yazen.ghannam@amd.com> References: <20230127170419.1824692-1-yazen.ghannam@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT089:EE_|SA1PR12MB6701:EE_ X-MS-Office365-Filtering-Correlation-Id: c657c9c5-4c5e-40ed-da7c-08db00889192 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MYzB8wBT8aGZ1PU1UVw+/CiOPu8I25jyD+jGAcS9USjegNKfWx08/pwekaEUjJ9HZXeu3OpWxYNt4wzXwzZzpRwVJKAM9rxRxWcwQW811kGtpV2OeuBKrr0auGwq9uChUOfZ/R7NrSUeyJvwihrQtPBnZgjeFjrT84XrZarJZYVfJrO/q+fMvQapNZuqlbw6O0Mh0Zro/0F0zEijSvg7VBPG6IHEOvT/aAjzUr5S8AmdVbEq8A5CEBOCywp3hf6jvln3rNu2iCo49l+MfB/dUTv1r2w+SkaToYO7/J8cWWBM0lnN8dtqDtd6wSzJHRfo+jkH7TrBMw+xTLCh5eyH1dqP/H0N89nBTXnQ5O/P1a5H+O2kJ5BXXgAIVb/scsB4lrA2JtzwRQdj37AKI3urXujHRnc7uCaTRpVOmXS+3tipyOY1lP/OGkx/5iHJ14l5fL12yS+2yvmvph3CCKmfokvpR1aM9RUeMOqe7+DMvWUXAJm8mquY2XRRf6PXR315gIwT3YhieBiAH3XCYbPQ9+qOte4SPCdRaYsBLumacQ/Go5ojxavw1NDwTdfXlokr4ZRhPkUXEgkQiJvnZLxTFgzzQ7pKHd0FsgJAcDaTNrb/WQRo16jXj8LwGAfU9Kt6nc4i+/eBQBjDosHsGfm+pGcQc6Wf9ggkn31jH9VVvvLvjWKny0TVemwRW8g0Va7F2iqoghOazStC3Egh5VJqT5eUkCevhn+4lMl6YDyW/2PJ3Uc3UbwrqRfLYqsDpTzhkboUqkNqfah/S93Of/Ni3w== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230025)(4636009)(346002)(39860400002)(376002)(136003)(396003)(451199018)(40470700004)(36840700001)(46966006)(8936002)(426003)(2906002)(44832011)(336012)(356005)(54906003)(81166007)(86362001)(30864003)(82740400003)(40480700001)(41300700001)(966005)(110136005)(70586007)(4326008)(186003)(36860700001)(5660300002)(26005)(16526019)(7696005)(316002)(70206006)(1076003)(82310400005)(47076005)(2616005)(8676002)(478600001)(40460700003)(83380400001)(36756003)(6666004)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2023 17:04:36.0304 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c657c9c5-4c5e-40ed-da7c-08db00889192 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT089.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB6701 Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org From: Muralidhara M K Future AMD systems will support heterogeneous "AMD Node" types, e.g. CPU+GPU. Therefore, a global "family type" shared across all "AMD Nodes" is no longer appropriate. Move struct low_ops routines and members of struct amd64_family_type to struct amd64_pvt. Currently, there are many code branches that split between "modern" and "legacy" systems. Another code branch will be needed in order to cover "GPU" cases. However, rather than introduce another branching case in multiple functions, the current branching code should be switched to a set of function pointers. This change makes the code more readable and simplifies adding support for new families/models. In order to reuse code, define two sets of function pointers. Use one for modern systems (Family 17h and later). This will not change between current CPU families. Use another set of function pointers for legacy systems (before Family 17h). Use the Family 16h versions as default for the legacy ops since these are the latest, and adjust the function pointers as needed for older families. Signed-off-by: Muralidhara M K Co-developed-by: Naveen Krishna Chatradhi Signed-off-by: Naveen Krishna Chatradhi [Rebased/reworked patch and reworded commit message] Co-developed-by: Yazen Ghannam Signed-off-by: Yazen Ghannam --- Link: https://lore.kernel.org/r/20220509145534.44912-6-yazen.ghannam@amd.com v1->v2: * Same a v1 patch 5, but rebased on new patches. drivers/edac/amd64_edac.c | 308 ++++++++++++++------------------------ drivers/edac/amd64_edac.h | 62 +++----- 2 files changed, 133 insertions(+), 237 deletions(-) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 1d5c2c97d563..a9b20bc413af 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -13,11 +13,9 @@ module_param(ecc_enable_override, int, 0644); static struct msr __percpu *msrs; -static struct amd64_family_type *fam_type; - -static inline u32 get_umc_reg(u32 reg) +static inline u32 get_umc_reg(struct amd64_pvt *pvt, u32 reg) { - if (!fam_type->flags.zn_regs_v2) + if (!pvt->flags.zn_regs_v2) return reg; switch (reg) { @@ -437,7 +435,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 < fam_type->max_mcs; i++) + for (i = 0; i < pvt->max_mcs; i++) /* * @input_addr is an InputAddr associated with the node given by mci. Return the @@ -1464,7 +1462,7 @@ static int umc_addr_mask_to_cs_size(struct amd64_pvt *pvt, u8 umc, */ dimm = csrow_nr >> 1; - if (!fam_type->flags.zn_regs_v2) + if (!pvt->flags.zn_regs_v2) cs_mask_nr >>= 1; /* Asymmetric dual-rank DIMM support. */ @@ -1556,7 +1554,7 @@ static void __dump_misc_regs_df(struct amd64_pvt *pvt) if (umc->dram_type == MEM_LRDDR4 || umc->dram_type == MEM_LRDDR5) { amd_smn_read(pvt->mc_node_id, - umc_base + get_umc_reg(UMCCH_ADDR_CFG), + umc_base + get_umc_reg(pvt, UMCCH_ADDR_CFG), &tmp); edac_dbg(1, "UMC%d LRDIMM %dx rank multiply\n", i, 1 << ((tmp >> 4) & 0x3)); @@ -1629,7 +1627,7 @@ static void prep_chip_selects(struct amd64_pvt *pvt) for_each_umc(umc) { pvt->csels[umc].b_cnt = 4; - pvt->csels[umc].m_cnt = fam_type->flags.zn_regs_v2 ? 4 : 2; + pvt->csels[umc].m_cnt = pvt->flags.zn_regs_v2 ? 4 : 2; } } else { @@ -1669,7 +1667,7 @@ static void read_umc_base_mask(struct amd64_pvt *pvt) } umc_mask_reg = get_umc_base(umc) + UMCCH_ADDR_MASK; - umc_mask_reg_sec = get_umc_base(umc) + get_umc_reg(UMCCH_ADDR_MASK_SEC); + umc_mask_reg_sec = get_umc_base(umc) + get_umc_reg(pvt, UMCCH_ADDR_MASK_SEC); for_each_chip_select_mask(cs, umc, pvt) { mask = &pvt->csels[umc].csmasks[cs]; @@ -1757,7 +1755,7 @@ static void determine_memory_type_df(struct amd64_pvt *pvt) * Check if the system supports the "DDR Type" field in UMC Config * and has DDR5 DIMMs in use. */ - if (fam_type->flags.zn_regs_v2 && ((umc->umc_cfg & GENMASK(2, 0)) == 0x1)) { + if (pvt->flags.zn_regs_v2 && ((umc->umc_cfg & GENMASK(2, 0)) == 0x1)) { if (umc->dimm_cfg & BIT(5)) umc->dram_type = MEM_LRDDR5; else if (umc->dimm_cfg & BIT(4)) @@ -2739,112 +2737,6 @@ static void f1x_map_sysaddr_to_csrow(struct mem_ctl_info *mci, u64 sys_addr, err->channel = get_channel_from_ecc_syndrome(mci, err->syndrome); } -static struct amd64_family_type family_types[] = { - [K8_CPUS] = { - .ctl_name = "K8", - .f1_id = PCI_DEVICE_ID_AMD_K8_NB_ADDRMAP, - .f2_id = PCI_DEVICE_ID_AMD_K8_NB_MEMCTL, - .max_mcs = 2, - .ops = { - .map_sysaddr_to_csrow = k8_map_sysaddr_to_csrow, - .dbam_to_cs = k8_dbam_to_chip_select, - } - }, - [F10_CPUS] = { - .ctl_name = "F10h", - .f1_id = PCI_DEVICE_ID_AMD_10H_NB_MAP, - .f2_id = PCI_DEVICE_ID_AMD_10H_NB_DRAM, - .max_mcs = 2, - .ops = { - .map_sysaddr_to_csrow = f1x_map_sysaddr_to_csrow, - .dbam_to_cs = f10_dbam_to_chip_select, - } - }, - [F15_CPUS] = { - .ctl_name = "F15h", - .f1_id = PCI_DEVICE_ID_AMD_15H_NB_F1, - .f2_id = PCI_DEVICE_ID_AMD_15H_NB_F2, - .max_mcs = 2, - .ops = { - .map_sysaddr_to_csrow = f1x_map_sysaddr_to_csrow, - .dbam_to_cs = f15_dbam_to_chip_select, - } - }, - [F15_M30H_CPUS] = { - .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_mcs = 2, - .ops = { - .map_sysaddr_to_csrow = f1x_map_sysaddr_to_csrow, - .dbam_to_cs = f16_dbam_to_chip_select, - } - }, - [F15_M60H_CPUS] = { - .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_mcs = 2, - .ops = { - .map_sysaddr_to_csrow = f1x_map_sysaddr_to_csrow, - .dbam_to_cs = f15_m60h_dbam_to_chip_select, - } - }, - [F16_CPUS] = { - .ctl_name = "F16h", - .f1_id = PCI_DEVICE_ID_AMD_16H_NB_F1, - .f2_id = PCI_DEVICE_ID_AMD_16H_NB_F2, - .max_mcs = 2, - .ops = { - .map_sysaddr_to_csrow = f1x_map_sysaddr_to_csrow, - .dbam_to_cs = f16_dbam_to_chip_select, - } - }, - [F16_M30H_CPUS] = { - .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_mcs = 2, - .ops = { - .map_sysaddr_to_csrow = f1x_map_sysaddr_to_csrow, - .dbam_to_cs = f16_dbam_to_chip_select, - } - }, - [F17_CPUS] = { - .ctl_name = "F17h", - .max_mcs = 2, - }, - [F17_M10H_CPUS] = { - .ctl_name = "F17h_M10h", - .max_mcs = 2, - }, - [F17_M30H_CPUS] = { - .ctl_name = "F17h_M30h", - .max_mcs = 8, - }, - [F17_M60H_CPUS] = { - .ctl_name = "F17h_M60h", - .max_mcs = 2, - }, - [F17_M70H_CPUS] = { - .ctl_name = "F17h_M70h", - .max_mcs = 2, - }, - [F19_CPUS] = { - .ctl_name = "F19h", - .max_mcs = 8, - }, - [F19_M10H_CPUS] = { - .ctl_name = "F19h_M10h", - .max_mcs = 12, - .flags.zn_regs_v2 = 1, - }, - [F19_M50H_CPUS] = { - .ctl_name = "F19h_M50h", - .max_mcs = 2, - }, -}; - /* * These are tables of eigenvectors (one per line) which can be used for the * construction of the syndrome tables. The modified syndrome search algorithm @@ -3226,7 +3118,7 @@ static void __read_mc_regs_df(struct amd64_pvt *pvt) umc_base = get_umc_base(i); umc = &pvt->umc[i]; - amd_smn_read(nid, umc_base + get_umc_reg(UMCCH_DIMM_CFG), &umc->dimm_cfg); + amd_smn_read(nid, umc_base + get_umc_reg(pvt, UMCCH_DIMM_CFG), &umc->dimm_cfg); amd_smn_read(nid, umc_base + UMCCH_UMC_CFG, &umc->umc_cfg); amd_smn_read(nid, umc_base + UMCCH_SDP_CTRL, &umc->sdp_ctrl); amd_smn_read(nid, umc_base + UMCCH_ECC_CTRL, &umc->ecc_ctrl); @@ -3495,7 +3387,7 @@ static int init_csrows(struct mem_ctl_info *mci) : EDAC_SECDED; } - for (j = 0; j < fam_type->max_mcs; j++) { + for (j = 0; j < pvt->max_mcs; j++) { dimm = csrow->channels[j]->dimm; dimm->mtype = pvt->dram_type; dimm->edac_mode = edac_mode; @@ -3767,7 +3659,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_type->ctl_name; + mci->ctl_name = pvt->ctl_name; mci->dev_name = pci_name(pvt->F3); mci->ctl_page_to_phys = NULL; @@ -3779,114 +3671,145 @@ static void setup_mci_misc_attrs(struct mem_ctl_info *mci) mci->get_sdram_scrub_rate = get_scrub_rate; } -/* - * returns a pointer to the family descriptor on success, NULL otherwise. - */ -static struct amd64_family_type *per_family_init(struct amd64_pvt *pvt) +static struct low_ops umc_ops = { +}; + +/* Use Family 16h versions for defaults and adjust as needed below. */ +static struct low_ops dct_ops = { + .map_sysaddr_to_csrow = f1x_map_sysaddr_to_csrow, + .dbam_to_cs = f16_dbam_to_chip_select, +}; + +static int per_family_init(struct amd64_pvt *pvt) { pvt->ext_model = boot_cpu_data.x86_model >> 4; pvt->stepping = boot_cpu_data.x86_stepping; pvt->model = boot_cpu_data.x86_model; pvt->fam = boot_cpu_data.x86; + pvt->max_mcs = 2; + + /* + * Decide on which ops group to use here and do any family/model + * overrides below. + */ + if (pvt->fam >= 0x17) + pvt->ops = &umc_ops; + else + pvt->ops = &dct_ops; switch (pvt->fam) { case 0xf: - fam_type = &family_types[K8_CPUS]; - pvt->ops = &family_types[K8_CPUS].ops; + pvt->ctl_name = (pvt->ext_model > K8_REV_F) ? + "K8 revF or later" : "K8 revE or earlier"; + pvt->f1_id = PCI_DEVICE_ID_AMD_K8_NB_ADDRMAP; + pvt->f2_id = PCI_DEVICE_ID_AMD_K8_NB_MEMCTL; + pvt->ops->map_sysaddr_to_csrow = k8_map_sysaddr_to_csrow; + pvt->ops->dbam_to_cs = k8_dbam_to_chip_select; break; case 0x10: - fam_type = &family_types[F10_CPUS]; - pvt->ops = &family_types[F10_CPUS].ops; + pvt->ctl_name = "F10h"; + pvt->f1_id = PCI_DEVICE_ID_AMD_10H_NB_MAP; + pvt->f2_id = PCI_DEVICE_ID_AMD_10H_NB_DRAM; + pvt->ops->dbam_to_cs = f10_dbam_to_chip_select; break; case 0x15: - if (pvt->model == 0x30) { - fam_type = &family_types[F15_M30H_CPUS]; - pvt->ops = &family_types[F15_M30H_CPUS].ops; + switch (pvt->model) { + case 0x30: + pvt->ctl_name = "F15h_M30h"; + pvt->f1_id = PCI_DEVICE_ID_AMD_15H_M30H_NB_F1; + pvt->f2_id = PCI_DEVICE_ID_AMD_15H_M30H_NB_F2; break; - } else if (pvt->model == 0x60) { - fam_type = &family_types[F15_M60H_CPUS]; - pvt->ops = &family_types[F15_M60H_CPUS].ops; + case 0x60: + pvt->ctl_name = "F15h_M60h"; + pvt->f1_id = PCI_DEVICE_ID_AMD_15H_M60H_NB_F1; + pvt->f2_id = PCI_DEVICE_ID_AMD_15H_M60H_NB_F2; + pvt->ops->dbam_to_cs = f15_m60h_dbam_to_chip_select; + break; + case 0x13: + /* Richland is only client */ + return -ENODEV; + default: + pvt->ctl_name = "F15h"; + pvt->f1_id = PCI_DEVICE_ID_AMD_15H_NB_F1; + pvt->f2_id = PCI_DEVICE_ID_AMD_15H_NB_F2; + pvt->ops->dbam_to_cs = f15_dbam_to_chip_select; break; - /* Richland is only client */ - } else if (pvt->model == 0x13) { - return NULL; - } else { - fam_type = &family_types[F15_CPUS]; - pvt->ops = &family_types[F15_CPUS].ops; } break; case 0x16: - if (pvt->model == 0x30) { - fam_type = &family_types[F16_M30H_CPUS]; - pvt->ops = &family_types[F16_M30H_CPUS].ops; + switch (pvt->model) { + case 0x30: + pvt->ctl_name = "F16h_M30h"; + pvt->f1_id = PCI_DEVICE_ID_AMD_16H_M30H_NB_F1; + pvt->f2_id = PCI_DEVICE_ID_AMD_16H_M30H_NB_F2; + break; + default: + pvt->ctl_name = "F16h"; + pvt->f1_id = PCI_DEVICE_ID_AMD_16H_NB_F1; + pvt->f2_id = PCI_DEVICE_ID_AMD_16H_NB_F2; break; } - fam_type = &family_types[F16_CPUS]; - pvt->ops = &family_types[F16_CPUS].ops; break; case 0x17: - if (pvt->model >= 0x10 && pvt->model <= 0x2f) { - fam_type = &family_types[F17_M10H_CPUS]; - pvt->ops = &family_types[F17_M10H_CPUS].ops; + switch (pvt->model) { + case 0x10 ... 0x2f: + pvt->ctl_name = "F17h_M10h"; break; - } else if (pvt->model >= 0x30 && pvt->model <= 0x3f) { - fam_type = &family_types[F17_M30H_CPUS]; - pvt->ops = &family_types[F17_M30H_CPUS].ops; + case 0x30 ... 0x3f: + pvt->ctl_name = "F17h_M30h"; + pvt->max_mcs = 8; break; - } else if (pvt->model >= 0x60 && pvt->model <= 0x6f) { - fam_type = &family_types[F17_M60H_CPUS]; - pvt->ops = &family_types[F17_M60H_CPUS].ops; + case 0x60 ... 0x6f: + pvt->ctl_name = "F17h_M60h"; break; - } else if (pvt->model >= 0x70 && pvt->model <= 0x7f) { - fam_type = &family_types[F17_M70H_CPUS]; - pvt->ops = &family_types[F17_M70H_CPUS].ops; + case 0x70 ... 0x7f: + pvt->ctl_name = "F17h_M70h"; + break; + default: + pvt->ctl_name = "F17h"; break; } - fallthrough; - case 0x18: - fam_type = &family_types[F17_CPUS]; - pvt->ops = &family_types[F17_CPUS].ops; + break; - if (pvt->fam == 0x18) - family_types[F17_CPUS].ctl_name = "F18h"; + case 0x18: + pvt->ctl_name = "F18h"; break; case 0x19: - if (pvt->model >= 0x10 && pvt->model <= 0x1f) { - fam_type = &family_types[F19_M10H_CPUS]; - pvt->ops = &family_types[F19_M10H_CPUS].ops; + switch (pvt->model) { + case 0x00 ... 0x0f: + pvt->ctl_name = "F19h"; + pvt->max_mcs = 8; break; - } else if (pvt->model >= 0x20 && pvt->model <= 0x2f) { - fam_type = &family_types[F17_M70H_CPUS]; - pvt->ops = &family_types[F17_M70H_CPUS].ops; - fam_type->ctl_name = "F19h_M20h"; + case 0x10 ... 0x1f: + pvt->ctl_name = "F19h_M10h"; + pvt->max_mcs = 12; + pvt->flags.zn_regs_v2 = 1; break; - } else if (pvt->model >= 0x50 && pvt->model <= 0x5f) { - fam_type = &family_types[F19_M50H_CPUS]; - pvt->ops = &family_types[F19_M50H_CPUS].ops; - fam_type->ctl_name = "F19h_M50h"; + case 0x20 ... 0x2f: + pvt->ctl_name = "F19h_M20h"; break; - } else if (pvt->model >= 0xa0 && pvt->model <= 0xaf) { - fam_type = &family_types[F19_M10H_CPUS]; - pvt->ops = &family_types[F19_M10H_CPUS].ops; - fam_type->ctl_name = "F19h_MA0h"; + case 0x50 ... 0x5f: + pvt->ctl_name = "F19h_M50h"; + break; + case 0xa0 ... 0xaf: + pvt->ctl_name = "F19h_MA0h"; + pvt->max_mcs = 12; + pvt->flags.zn_regs_v2 = 1; break; } - fam_type = &family_types[F19_CPUS]; - pvt->ops = &family_types[F19_CPUS].ops; - family_types[F19_CPUS].ctl_name = "F19h"; break; default: amd64_err("Unsupported family!\n"); - return NULL; + return -ENODEV; } - return fam_type; + return 0; } static const struct attribute_group *amd64_edac_attr_groups[] = { @@ -3903,12 +3826,12 @@ static int hw_info_get(struct amd64_pvt *pvt) int ret; if (pvt->fam >= 0x17) { - pvt->umc = kcalloc(fam_type->max_mcs, sizeof(struct amd64_umc), GFP_KERNEL); + pvt->umc = kcalloc(pvt->max_mcs, sizeof(struct amd64_umc), GFP_KERNEL); if (!pvt->umc) return -ENOMEM; } else { - pci_id1 = fam_type->f1_id; - pci_id2 = fam_type->f2_id; + pci_id1 = pvt->f1_id; + pci_id2 = pvt->f2_id; } ret = reserve_mc_sibling_devs(pvt, pci_id1, pci_id2); @@ -3938,7 +3861,7 @@ static int init_one_instance(struct amd64_pvt *pvt) layers[0].size = pvt->csels[0].b_cnt; layers[0].is_virt_csrow = true; layers[1].type = EDAC_MC_LAYER_CHANNEL; - layers[1].size = fam_type->max_mcs; + layers[1].size = pvt->max_mcs; layers[1].is_virt_csrow = false; mci = edac_mc_alloc(pvt->mc_node_id, ARRAY_SIZE(layers), layers, 0); @@ -3968,7 +3891,7 @@ 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_mcs; dct++) { + for (dct = 0; dct < pvt->max_mcs; dct++) { for_each_chip_select(cs, dct, pvt) cs_enabled |= csrow_enabled(cs, dct, pvt); } @@ -3997,9 +3920,8 @@ static int probe_one_instance(unsigned int nid) pvt->mc_node_id = nid; pvt->F3 = F3; - ret = -ENODEV; - fam_type = per_family_init(pvt); - if (!fam_type) + ret = per_family_init(pvt); + if (ret < 0) goto err_enable; ret = hw_info_get(pvt); @@ -4038,11 +3960,7 @@ static int probe_one_instance(unsigned int nid) goto err_enable; } - amd64_info("%s %sdetected (node %d).\n", fam_type->ctl_name, - (pvt->fam == 0xf ? - (pvt->ext_model >= K8_REV_F ? "revF or later " - : "revE or earlier ") - : ""), pvt->mc_node_id); + amd64_info("%s detected (node %d).\n", pvt->ctl_name, pvt->mc_node_id); dump_misc_regs(pvt); diff --git a/drivers/edac/amd64_edac.h b/drivers/edac/amd64_edac.h index e4329dff8cf2..8eea15546b9f 100644 --- a/drivers/edac/amd64_edac.h +++ b/drivers/edac/amd64_edac.h @@ -273,25 +273,6 @@ #define UMC_SDP_INIT BIT(31) -enum amd_families { - K8_CPUS = 0, - F10_CPUS, - F15_CPUS, - F15_M30H_CPUS, - F15_M60H_CPUS, - F16_CPUS, - F16_M30H_CPUS, - F17_CPUS, - F17_M10H_CPUS, - F17_M30H_CPUS, - F17_M60H_CPUS, - F17_M70H_CPUS, - F19_CPUS, - F19_M10H_CPUS, - F19_M50H_CPUS, - NUM_FAMILIES, -}; - /* Error injection control structure */ struct error_injection { u32 section; @@ -334,6 +315,16 @@ struct amd64_umc { enum mem_type dram_type; }; +struct amd64_family_flags { + /* + * Indicates that the system supports the new register offsets, etc. + * first introduced with Family 19h Model 10h. + */ + __u64 zn_regs_v2 : 1, + + __reserved : 63; +}; + struct amd64_pvt { struct low_ops *ops; @@ -375,6 +366,12 @@ struct amd64_pvt { /* x4, x8, or x16 syndromes in use */ u8 ecc_sym_sz; + const char *ctl_name; + u16 f1_id, f2_id; + /* Maximum number of memory controllers per die/node. */ + u8 max_mcs; + + struct amd64_family_flags flags; /* place to store error injection parameters prior to issue */ struct error_injection injection; @@ -465,29 +462,10 @@ struct ecc_settings { * functions and per device encoding/decoding logic. */ struct low_ops { - void (*map_sysaddr_to_csrow) (struct mem_ctl_info *mci, u64 sys_addr, - struct err_info *); - int (*dbam_to_cs) (struct amd64_pvt *pvt, u8 dct, - unsigned cs_mode, int cs_mask_nr); -}; - -struct amd64_family_flags { - /* - * Indicates that the system supports the new register offsets, etc. - * first introduced with Family 19h Model 10h. - */ - __u64 zn_regs_v2 : 1, - - __reserved : 63; -}; - -struct amd64_family_type { - const char *ctl_name; - u16 f1_id, f2_id; - /* Maximum number of memory controllers per die/node. */ - u8 max_mcs; - struct amd64_family_flags flags; - struct low_ops ops; + void (*map_sysaddr_to_csrow)(struct mem_ctl_info *mci, u64 sys_addr, + struct err_info *err); + int (*dbam_to_cs)(struct amd64_pvt *pvt, u8 dct, + unsigned int cs_mode, int cs_mask_nr); }; int __amd64_read_pci_cfg_dword(struct pci_dev *pdev, int offset, From patchwork Fri Jan 27 17:04:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 13119062 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3925C54EAA for ; Fri, 27 Jan 2023 17:05:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234868AbjA0RFc (ORCPT ); Fri, 27 Jan 2023 12:05:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234860AbjA0RFb (ORCPT ); Fri, 27 Jan 2023 12:05:31 -0500 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2062d.outbound.protection.outlook.com [IPv6:2a01:111:f400:7eab::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C78CE14E85; Fri, 27 Jan 2023 09:04:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jVGAx4XywkUIDCZdvaWOBxuA7rbi82+XVbj+Ty93HHYR+1PShQMiss9nV65rlwn9GrxXPUM2xS3MBNbtMm2s9djYHLcN591XAHIJWM2FRTCQIF6JbgkNnCFekuvM6/TVsANORcqJY2i8LRVSIFj4mKaT0YkuMy83IuRfNevv169Itj1GvtynN/yV5H6BzYFiYBDmXR2aSi8klpIVyUdyRan37dSVEigwBTJsCoZSwu0r7zWnyC9pEKyUApCtG81hNroTeiWAYtoZ9E0CdqV7i7oqv7sHfRlfhNElxzyN2/KfHnJ2Ptjn25rHpJ0m+aqW3UCDBtNOrnklku35Xg1BAA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=g4HjG9qPbWaKzSUa3tOSKFlbp5OZMjY8m7sQ4WPTUWo=; b=ja8WH5L2J/jpI9BaJ5hwES9iPb5tYCkl5xqQLbqm9Km/Ou8AZBP0kAZYz/IGLx2dYaok1HC8ER6XNnhDg6b/+upuGdrs6TwfXXE1OwK0Bo92+C53Gaz/hK5JJR2sJY5fJUzn6jnhWW3rqVaFPpZtU6jZRVGMi7wwiRWy1018j9VvgIerLuEcLXCpDh9cTFTaRgXPkfXNAO0k6GbXTOL83lv480IjCMdwd9KCJ4oSY5YNRBvsuPF9T7GtddOrjJUQiOD+HsbdK+TvzL4FKhUd+mfizOYdMtS3KqvIB0TpSU15k9rg3IdF7KUZCeygfVxYhHFXIZFOfnK2j/OeCmpIIw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=g4HjG9qPbWaKzSUa3tOSKFlbp5OZMjY8m7sQ4WPTUWo=; b=dgeO5wVS5stexsZI2b0DlklH6h+2QYdr6B9/D77bmGBo1dGqIrOPvQwQefTJY870bep4AmrZn3Kzip9ED0zaEM8l8eJrJstR4StPEj+jXcBfJ7eqSjRMOCnhGqaY4DD1Yr6aLzxq8/rV6zth4oMfJ9AJHhZy5InXpJM+R8fnRfM= Received: from BN9PR03CA0465.namprd03.prod.outlook.com (2603:10b6:408:139::20) by BL1PR12MB5318.namprd12.prod.outlook.com (2603:10b6:208:31d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.23; Fri, 27 Jan 2023 17:04:36 +0000 Received: from BN8NAM11FT016.eop-nam11.prod.protection.outlook.com (2603:10b6:408:139:cafe::bc) by BN9PR03CA0465.outlook.office365.com (2603:10b6:408:139::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.25 via Frontend Transport; Fri, 27 Jan 2023 17:04:36 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT016.mail.protection.outlook.com (10.13.176.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6043.23 via Frontend Transport; Fri, 27 Jan 2023 17:04:36 +0000 Received: from yaz-ethanolx.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 27 Jan 2023 11:04:34 -0600 From: Yazen Ghannam To: , CC: , , , Yazen Ghannam Subject: [PATCH v2 11/22] EDAC/amd64: Rework hw_info_{get,put} Date: Fri, 27 Jan 2023 17:04:08 +0000 Message-ID: <20230127170419.1824692-12-yazen.ghannam@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230127170419.1824692-1-yazen.ghannam@amd.com> References: <20230127170419.1824692-1-yazen.ghannam@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT016:EE_|BL1PR12MB5318:EE_ X-MS-Office365-Filtering-Correlation-Id: f4f6f66f-5c31-4328-b179-08db008891c7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FEIwPOI/CLoahNjR4q5CvI1iaeq8v2dcOO7UMu/4hMKMt9z2hcI4KXCqbxfiPOyv7aiewkMf0p54JzHxaZ8ZnvDpg8mxBHAIHgksibR+pzbi+P2Gevm1GgoA2i0jm8RMH0BzBmy7ILRjCLLnUMPhR9SZroFnWuQ2Ly3k+0h/9ECqNNj00kDaMhbTQJYS6h/e2UHMhmuEbqgzl1gtC5NXEX09/OUShWQEASpQi0Swr2XYfovC+fCqvPLz/fKaakJoeKXZ9cr1D3aNn9gsu2AAgBwQVISvdJUuVMf3DRUHDEetOGloXNtL+OMyVw5VBXB1GKTnXB5Dg7VUOykZa7CskxZ2CGKt0XpuBoR+nG4UaCAPIfjXtvC65+HqdR55uOyCagzrnBuQWL/93Ib1hcMY9WHTtnmdjFbbyJ+kHSxbgv6ytCj9I2VYNZZ8cLHqJLoPRs8KyNTCt38yRCV2Ro36ZteL3/z378sCPy2Ih9MNQaDXmNLIIk1WvIkNW45HI34qkFYSSTcCK1N7a4UAWQIZjd6wjWVbUxYc07VExN5fOdE12Rydj65w199XJ4WzQbZG0LITQkyuvwQjJoOL3LL98hKhdfYZY4EaGNeDiinp0H5AUNAHB+zIIIWaZ90jEhc/LFCWnhrBWRP9JG4m1dsntrDHCkj0vE3oS/ifseYRYlx3z7D0vutye4SF+xfsZKkD1c9TAfRe/nPsUNkIfBqtm8OjCmelU2EzoUg2U79QSwujmmJMCpNplKIGbj/cw9g3TVqJtjzAjL92YWFVO9QG9+bNocKvVOtU+6nj3bc9feoc6mLt5YxVSbOO6cWn+k29 X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230025)(4636009)(136003)(39860400002)(376002)(396003)(346002)(451199018)(36840700001)(46966006)(40470700004)(7696005)(6666004)(478600001)(26005)(1076003)(966005)(186003)(16526019)(5660300002)(8676002)(4326008)(70586007)(2906002)(110136005)(36860700001)(2616005)(44832011)(47076005)(316002)(54906003)(356005)(8936002)(86362001)(41300700001)(81166007)(40460700003)(82740400003)(70206006)(82310400005)(336012)(426003)(83380400001)(36756003)(40480700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2023 17:04:36.3924 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f4f6f66f-5c31-4328-b179-08db008891c7 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT016.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5318 Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org The bulk of system-specific information is gathered at init time with hw_info_get(). This function calls a number of helper functions, and many of these helper functions are split between a modern UMC/DF path and a legacy DCT path. Split hw_info_get() into legacy and modern versions. This creates two separate code paths early on, and legacy and modern helper functions can be called directly in the appropriate code path. Also, simplify hw_info_put() and share it between legacy and modern systems. NULL pointer checks are done in pci_dev_put() and kfree(), so they can be called unconditionally. Signed-off-by: Yazen Ghannam --- Link: https://lore.kernel.org/r/Yn0a9T9xqAkWnPWt@yaz-fattaah v1->v2: * New in v2. drivers/edac/amd64_edac.c | 78 +++++++++++++++++---------------------- drivers/edac/amd64_edac.h | 1 + 2 files changed, 34 insertions(+), 45 deletions(-) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index a9b20bc413af..3830b0a4b5dc 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -3045,9 +3045,6 @@ static void decode_umc_error(int node_id, struct mce *m) static int reserve_mc_sibling_devs(struct amd64_pvt *pvt, u16 pci_id1, u16 pci_id2) { - if (pvt->umc) - return 0; - /* Reserve the ADDRESS MAP Device */ pvt->F1 = pci_get_related_function(pvt->F3->vendor, pci_id1, pvt->F3); if (!pvt->F1) { @@ -3075,16 +3072,6 @@ reserve_mc_sibling_devs(struct amd64_pvt *pvt, u16 pci_id1, u16 pci_id2) return 0; } -static void free_mc_sibling_devs(struct amd64_pvt *pvt) -{ - if (pvt->umc) { - return; - } else { - pci_dev_put(pvt->F1); - pci_dev_put(pvt->F2); - } -} - static void determine_ecc_sym_sz(struct amd64_pvt *pvt) { pvt->ecc_sym_sz = 4; @@ -3671,13 +3658,45 @@ static void setup_mci_misc_attrs(struct mem_ctl_info *mci) mci->get_sdram_scrub_rate = get_scrub_rate; } +static int dct_hw_info_get(struct amd64_pvt *pvt) +{ + int ret = reserve_mc_sibling_devs(pvt, pvt->f1_id, pvt->f2_id); + + if (ret) + return ret; + + read_mc_regs(pvt); + + return 0; +} + +static int umc_hw_info_get(struct amd64_pvt *pvt) +{ + pvt->umc = kcalloc(pvt->max_mcs, sizeof(struct amd64_umc), GFP_KERNEL); + if (!pvt->umc) + return -ENOMEM; + + read_mc_regs(pvt); + + return 0; +} + +static void hw_info_put(struct amd64_pvt *pvt) +{ + pci_dev_put(pvt->F1); + pci_dev_put(pvt->F2); + kfree(pvt->umc); +} + static struct low_ops umc_ops = { + .hw_info_get = umc_hw_info_get, }; /* Use Family 16h versions for defaults and adjust as needed below. */ static struct low_ops dct_ops = { .map_sysaddr_to_csrow = f1x_map_sysaddr_to_csrow, .dbam_to_cs = f16_dbam_to_chip_select, + .hw_info_get = dct_hw_info_get, }; static int per_family_init(struct amd64_pvt *pvt) @@ -3820,37 +3839,6 @@ static const struct attribute_group *amd64_edac_attr_groups[] = { NULL }; -static int hw_info_get(struct amd64_pvt *pvt) -{ - u16 pci_id1, pci_id2; - int ret; - - if (pvt->fam >= 0x17) { - pvt->umc = kcalloc(pvt->max_mcs, sizeof(struct amd64_umc), GFP_KERNEL); - if (!pvt->umc) - return -ENOMEM; - } else { - pci_id1 = pvt->f1_id; - pci_id2 = pvt->f2_id; - } - - ret = reserve_mc_sibling_devs(pvt, pci_id1, pci_id2); - if (ret) - return ret; - - read_mc_regs(pvt); - - return 0; -} - -static void hw_info_put(struct amd64_pvt *pvt) -{ - if (pvt->F1) - free_mc_sibling_devs(pvt); - - kfree(pvt->umc); -} - static int init_one_instance(struct amd64_pvt *pvt) { struct mem_ctl_info *mci = NULL; @@ -3924,7 +3912,7 @@ static int probe_one_instance(unsigned int nid) if (ret < 0) goto err_enable; - ret = hw_info_get(pvt); + ret = pvt->ops->hw_info_get(pvt); if (ret < 0) goto err_enable; diff --git a/drivers/edac/amd64_edac.h b/drivers/edac/amd64_edac.h index 8eea15546b9f..00b3f32e3cbb 100644 --- a/drivers/edac/amd64_edac.h +++ b/drivers/edac/amd64_edac.h @@ -466,6 +466,7 @@ struct low_ops { struct err_info *err); int (*dbam_to_cs)(struct amd64_pvt *pvt, u8 dct, unsigned int cs_mode, int cs_mask_nr); + int (*hw_info_get)(struct amd64_pvt *pvt); }; int __amd64_read_pci_cfg_dword(struct pci_dev *pdev, int offset, From patchwork Fri Jan 27 17:04:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 13119070 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11D81C61DA4 for ; Fri, 27 Jan 2023 17:06:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234965AbjA0RGI (ORCPT ); Fri, 27 Jan 2023 12:06:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234954AbjA0RFn (ORCPT ); Fri, 27 Jan 2023 12:05:43 -0500 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on20602.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e8b::602]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6513656187; Fri, 27 Jan 2023 09:05:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IGfEIpKpm2l7dEdJvSjU3HsFdzqa7gBCVNxQE8qTteNG6p3YEitLLQQKd4g6B8vHa1jicHRdF7+URizNNx2I9dvqM9K/dm4kw2bYL/DTkjQOZsju8aPFOkNLVCBwcl82yERzr6/xIxQb37holR1lrKQsACLBoHSKxNAVLnEKWxwrKOvk4EmWhYHuW5q7GRv1Cs/WeH8uIe+qqlQ6E9iTQKcnM1uYDvetSJaA1KnWbgHuVo/oXOjod1I9Nmb2KfW7fMpYQ8zc+t0Epn2ESCiy3FUvOIFrNMN+K8DuVzIREFwzJ7ixDro7pz2noprExIrkM0zCVd1RchxPbxmKcndt7w== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=psKvRlbNDQC+N/zEsDTcdWaxGyXR/5GhHXvH7tWsFtE=; b=XHlOhdJ2Eca8sjNiZMHBZc90ETXGiIkZb6csZODKTN1LoEo/Bagh0LMLWZHL40me32lFJ9yJUbokTK3Rb/w07YCT8hyoV4rB7V0t6wFN/DHwwBCbZN+OYoADlNm6TRzoijbbQ1QbICgVojguqzv/DRI1PPXEsoaPsjiv2QuyXATPVzalsv4dJF+eGDCdTEKJVCMWlFkdMPXLtdAn2xtNdLRCQJYn+Q2x1dQHTSm1SYSVHiRAH6mf8TX/e9n6PC9JGgY4pGPAYgypeg/KEBFTs48fXjgFe+g4DDYVWZ4/VSSkazLayX8bNZd0FYQhBU0GnCucqa/wOBE32TY+pj4EMg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=psKvRlbNDQC+N/zEsDTcdWaxGyXR/5GhHXvH7tWsFtE=; b=ZGuBP8/hdUKZxbi7J3O6dGpM/pJMxH5QvBGrGYI+6cPidIGlPTd8XGnQpP/91qi0LshW6Qh47LSkSlU++2QJTYVCiFBkBVGDcc8p7QIsYYs/+KdxYalHROPOpNropkLb7ejP7dAnhfVjeHVTrhfDVPZPxZtAg19lL6rFHZQRr7Y= Received: from BN8PR04CA0047.namprd04.prod.outlook.com (2603:10b6:408:d4::21) by DM4PR12MB6302.namprd12.prod.outlook.com (2603:10b6:8:a4::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.22; Fri, 27 Jan 2023 17:04:36 +0000 Received: from BN8NAM11FT089.eop-nam11.prod.protection.outlook.com (2603:10b6:408:d4:cafe::72) by BN8PR04CA0047.outlook.office365.com (2603:10b6:408:d4::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.22 via Frontend Transport; Fri, 27 Jan 2023 17:04:36 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT089.mail.protection.outlook.com (10.13.176.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6023.16 via Frontend Transport; Fri, 27 Jan 2023 17:04:36 +0000 Received: from yaz-ethanolx.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 27 Jan 2023 11:04:34 -0600 From: Yazen Ghannam To: , CC: , , , Yazen Ghannam Subject: [PATCH v2 12/22] EDAC/amd64: Split prep_chip_selects() into dct/umc functions Date: Fri, 27 Jan 2023 17:04:09 +0000 Message-ID: <20230127170419.1824692-13-yazen.ghannam@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230127170419.1824692-1-yazen.ghannam@amd.com> References: <20230127170419.1824692-1-yazen.ghannam@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT089:EE_|DM4PR12MB6302:EE_ X-MS-Office365-Filtering-Correlation-Id: cc00c3f5-bfd7-404d-ad42-08db008891e8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GIBx6AFCJ6zoAQODIy/lg+cT03VxXE9bRJJySxnlWTJ9ySmj7buAv7hcjAuuEyb50h7aRf+jMGhZ/9jJWdKsaLLpPnHok0r450WI+JzaunQLbkF5yqFMW+Sxa2JaxPSjg0cbWWxUrLOv48sdzSl7UqFRhFtmvw3gzY9rVkIJwnddq4ibCk6tN0zzFi4djGSdAa4OWpTnihVfSERZRaif7GmJSov5y64oOvsELfvzmve4epetKNZdMAzWeHOMScPsOih5Uc+dTQ6GrEADVgqOHF7M4k+l6M1ueaHcdzaDFu5fRo6REpPC8Gq2i72wRmSFrh+UV/g788cwFicFMfU489tS5dXbk9XvNhL2U3DHnt6QJ8RUNGkqazfEcmaG42GlxlfZ/Po0rvoFlt7N5wLq0Q5JYxD8tCc7a3E4yHUZ2Aw42XdDifzgj/yCBCuht0IUaA1NgMYq5eHCWferbNGcDiQOvGMNBjV7aGfAOWBPOn3jySuCJ1Sqg53BDwEZyLBsoJKHKGTvjOpr36lnAdqTmBS2G6cv+/32zskL6Q8xrx5iWzMcQzGunlyG3p9iCvFmw/uumIzkF3UX/rr0f5DkVCd26csqV0KtrSCZ+y74P8x8jSFNeYcI1TlKSx5qY/xZN4RvJQ2UM0TzTPRHgQQ1U7BxQ/5pruULOrCNqwa0opjIf5+hF4e14D0S6KIWPcuU01wdT883ysbWYtkoDRAiusilGQdKDhnddJq0AWICk9aT8Yy11NAyi76jb/QjD0TPtk3dI9g19mZE/HBM1P+PCg== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230025)(4636009)(376002)(396003)(346002)(39860400002)(136003)(451199018)(36840700001)(46966006)(40470700004)(2906002)(5660300002)(356005)(44832011)(426003)(336012)(83380400001)(86362001)(40480700001)(81166007)(40460700003)(26005)(6666004)(82310400005)(70206006)(478600001)(966005)(41300700001)(7696005)(1076003)(70586007)(36860700001)(8676002)(2616005)(16526019)(47076005)(186003)(8936002)(316002)(110136005)(36756003)(4326008)(54906003)(82740400003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2023 17:04:36.6085 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cc00c3f5-bfd7-404d-ad42-08db008891e8 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT089.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6302 Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org From: Muralidhara M K ...and call them from their respective hw_info_get() function. This avoids the need for family/model-based function pointers. Add the calls before reading hardware registers from the memory controllers, since the number of chip select bases and masks needs to be known first. Signed-off-by: Muralidhara M K Co-developed-by: Naveen Krishna Chatradhi Signed-off-by: Naveen Krishna Chatradhi [Rebased/reworked patch and reworded commit message] Co-developed-by: Yazen Ghannam Signed-off-by: Yazen Ghannam --- Link: https://lore.kernel.org/r/20220509145534.44912-7-yazen.ghannam@amd.com v1->v2: * Call functions directly instead of using pointers. drivers/edac/amd64_edac.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 3830b0a4b5dc..fc15b6dea177 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -1614,7 +1614,7 @@ static void dump_misc_regs(struct amd64_pvt *pvt) /* * See BKDG, F2x[1,0][5C:40], F2[1,0][6C:60] */ -static void prep_chip_selects(struct amd64_pvt *pvt) +static void dct_prep_chip_selects(struct amd64_pvt *pvt) { if (pvt->fam == 0xf && pvt->ext_model < K8_REV_F) { pvt->csels[0].b_cnt = pvt->csels[1].b_cnt = 8; @@ -1622,20 +1622,22 @@ static void prep_chip_selects(struct amd64_pvt *pvt) } else if (pvt->fam == 0x15 && pvt->model == 0x30) { pvt->csels[0].b_cnt = pvt->csels[1].b_cnt = 4; pvt->csels[0].m_cnt = pvt->csels[1].m_cnt = 2; - } else if (pvt->fam >= 0x17) { - int umc; - - for_each_umc(umc) { - pvt->csels[umc].b_cnt = 4; - pvt->csels[umc].m_cnt = pvt->flags.zn_regs_v2 ? 4 : 2; - } - } else { pvt->csels[0].b_cnt = pvt->csels[1].b_cnt = 8; pvt->csels[0].m_cnt = pvt->csels[1].m_cnt = 4; } } +static void umc_prep_chip_selects(struct amd64_pvt *pvt) +{ + int umc; + + for_each_umc(umc) { + pvt->csels[umc].b_cnt = 4; + pvt->csels[umc].m_cnt = pvt->flags.zn_regs_v2 ? 4 : 2; + } +} + static void read_umc_base_mask(struct amd64_pvt *pvt) { u32 umc_base_reg, umc_base_reg_sec; @@ -1694,8 +1696,6 @@ static void read_dct_base_mask(struct amd64_pvt *pvt) { int cs; - prep_chip_selects(pvt); - if (pvt->umc) return read_umc_base_mask(pvt); @@ -3665,6 +3665,7 @@ static int dct_hw_info_get(struct amd64_pvt *pvt) if (ret) return ret; + dct_prep_chip_selects(pvt); read_mc_regs(pvt); return 0; @@ -3676,6 +3677,7 @@ static int umc_hw_info_get(struct amd64_pvt *pvt) if (!pvt->umc) return -ENOMEM; + umc_prep_chip_selects(pvt); read_mc_regs(pvt); return 0; From patchwork Fri Jan 27 17:04:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 13119063 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3D14C54EAA for ; Fri, 27 Jan 2023 17:05:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234896AbjA0RFn (ORCPT ); Fri, 27 Jan 2023 12:05:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234897AbjA0RFe (ORCPT ); Fri, 27 Jan 2023 12:05:34 -0500 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on20600.outbound.protection.outlook.com [IPv6:2a01:111:f400:7eae::600]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7CD6F35BB; Fri, 27 Jan 2023 09:05:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IFT1Blqqg7Sam7KXDhEC7vS+onRm58z1Js5Rn19XO/qTjzNVDv1e7cdmheya3CU8jqeI0VC+R60TAgoWZB39etQVTNyrIj4zv6fAWmRo75lJJDHC2pCmVYtyodQeeSm6gSvPTMOaJR6Wso2Q4so7nJa1tccwCAy49vthSBvp7oGu/G+uLAPb/i/Q2JVJs9cYumTy7vTVFEoYMFe5lHvvaYgIbW9yP5IkH5DYEHDHPsVPJUnF5aguHrwNX7J6/pwR0RDiox14ZRwX0l4doz8buerf6jsTn13shZWZVNTWC4A3oG8FmAEBDlA0HvGezzek1WSJqhixUGYvdNXd8I6V4Q== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=20xyv3oSjovdoFNK1bVJ3cgFaYMjTVDQb8G2b+Qq5KM=; b=Z9EIZLy9eMP6xW2323psYJKgF52ptVamHEHFrCWa+xdAo28mm+jHKAmn81r3rAScm/qDFcMiKKW4ppC8Avytz/YWYleQ61Bqkrvm9/GqbqpMX0EpiGJj1UkoHPs3NiSAdiNn/TViAC6pWlLSnduOrn4FBGiy2LfWRQ3fJaGXhG8rmKQTj7jgXERmdTVjQVIhm0tfUSBQh8oFbQNLWgVdxavnPYt1kk8tiwmaDuMXYbUT194p5JJ+v7wsX9b78ZmJ4FBRwOfZprnmND7I9f1wTpbiime87Ph7xeEFsXZh/UwRBFmnwpkWhjGak4hbBg85DznI0nEbBWX4R5gyYCkKGA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=20xyv3oSjovdoFNK1bVJ3cgFaYMjTVDQb8G2b+Qq5KM=; b=0Po1cnhwIURBJOPNO4KmTpBUXkS1gYDvGGQ4rwnXsuGxC4QPI+FioTp2507DjzDIbY6V4oGyVEhokfeWqHp1dRkqYNdgnLFKAKspDevcbqicOajlEQXMCt+oEDMughS3qS32k5/4y8B8R6ChYrdHY+CGBCE2Rc3wdCG8dBRcJS8= Received: from BN9PR03CA0452.namprd03.prod.outlook.com (2603:10b6:408:139::7) by SA1PR12MB7295.namprd12.prod.outlook.com (2603:10b6:806:2b6::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.23; Fri, 27 Jan 2023 17:04:37 +0000 Received: from BN8NAM11FT016.eop-nam11.prod.protection.outlook.com (2603:10b6:408:139:cafe::70) by BN9PR03CA0452.outlook.office365.com (2603:10b6:408:139::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.25 via Frontend Transport; Fri, 27 Jan 2023 17:04:36 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT016.mail.protection.outlook.com (10.13.176.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6043.23 via Frontend Transport; Fri, 27 Jan 2023 17:04:36 +0000 Received: from yaz-ethanolx.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 27 Jan 2023 11:04:35 -0600 From: Yazen Ghannam To: , CC: , , , Yazen Ghannam Subject: [PATCH v2 13/22] EDAC/amd64: Split read_base_mask() into dct/umc functions Date: Fri, 27 Jan 2023 17:04:10 +0000 Message-ID: <20230127170419.1824692-14-yazen.ghannam@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230127170419.1824692-1-yazen.ghannam@amd.com> References: <20230127170419.1824692-1-yazen.ghannam@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT016:EE_|SA1PR12MB7295:EE_ X-MS-Office365-Filtering-Correlation-Id: 89ace436-b59a-4a89-c01a-08db00889218 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2tEj60B2Y7thbgWyEHnmLs+ObLgYxtAe3Y9OuKTljQzfzT24RXJ2PJlVEmkIMqiP/FL5GUDyNGvqD4pNQfMO/IPCJbHPKcvi/BcouoldgO81L4acBbfx9CgLW5MLr+CIZvfk0DGAMZOL+vr3Hr17py7uYvYzdw9E/dGDNYrX12qP0xOkD8jhEd+WngRdy20fLooZzoz2H+cOY/SFRDSmNmbgnEUc37bt2rcDr6LSxMGQP8NYi5r9qtIM7LcMpN556drG2VWOf2eQT2a1h5OnG3W/Mm36pYx1wQXYzlEWWFphj7/0zc3oqF9z+TSWzu082G//VsVj2pKOO0/D/+HPwaR+P/j1LHjehpTmFaK1Jt+rVyK1Q7U+4KSwPtnBAeUdQHxhKBWFkPy9dyDfIHs9muARKMQ4Ktsq2VVCSs0GvQaMuMaKrBNvvOmZJhIHM8DIV2OxqCMO766VKpy6l9FoMndN0bU3dt+UiltvX3oKHnAGOxgp4pgRCCXKbXwYhlejY3pIt0oq4Yh5tntcqXuhp4gfVS/OUhrCObSU/MbQ2/7Yg4cWjco+x1I7PVoOicIgT5SuZgohmtU0QWW2mVRr2L0wN8DPijy2a6It6ZQx0hLzxVmHkbBq271WxPsaJ57NHMSM6k2XzxBE8tO1CjTGMGCHaNuNMAe8ZgA8LeN54ug7eIGVpOooVCalazhqqP5I0lba4Ut8RhqFH1m7XwjeX1xhsgh9WWZjP2doB/SEF/bPz50/6gGd0AlxlGwvdrsAgjEDSYxoUZORXPmZNtpA28cYIqPhDEyjMfFDohbVMsNSjyKnGpe/G28N7fCk6gGi X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230025)(4636009)(346002)(396003)(376002)(39860400002)(136003)(451199018)(46966006)(36840700001)(40470700004)(70586007)(41300700001)(70206006)(83380400001)(4326008)(8676002)(316002)(8936002)(40460700003)(36756003)(26005)(16526019)(186003)(356005)(44832011)(47076005)(36860700001)(426003)(40480700001)(2906002)(110136005)(5660300002)(54906003)(336012)(6666004)(7696005)(1076003)(82740400003)(478600001)(81166007)(82310400005)(966005)(86362001)(2616005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2023 17:04:36.9236 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 89ace436-b59a-4a89-c01a-08db00889218 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT016.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7295 Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org From: Muralidhara M K ...and call them from their respective hw_info_get() paths. Call the new functions after the setting the chip select base and mask counts, since those are need to read the correct number of chip select base and mask registers. And call the new functions before the remaining set up, because the base and mask register values will be needed later. Signed-off-by: Muralidhara M K Co-developed-by: Naveen Krishna Chatradhi Signed-off-by: Naveen Krishna Chatradhi [Rebased/reworked patch and reworded commit message] Co-developed-by: Yazen Ghannam Signed-off-by: Yazen Ghannam --- Link: https://lore.kernel.org/r/20220509145534.44912-8-yazen.ghannam@amd.com v1->v2: * Call functions directly instead of using pointers. drivers/edac/amd64_edac.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index fc15b6dea177..9310c0fdeb22 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -1638,7 +1638,7 @@ static void umc_prep_chip_selects(struct amd64_pvt *pvt) } } -static void read_umc_base_mask(struct amd64_pvt *pvt) +static void umc_read_base_mask(struct amd64_pvt *pvt) { u32 umc_base_reg, umc_base_reg_sec; u32 umc_mask_reg, umc_mask_reg_sec; @@ -1692,13 +1692,10 @@ static void read_umc_base_mask(struct amd64_pvt *pvt) /* * Function 2 Offset F10_DCSB0; read in the DCS Base and DCS Mask registers */ -static void read_dct_base_mask(struct amd64_pvt *pvt) +static void dct_read_base_mask(struct amd64_pvt *pvt) { int cs; - if (pvt->umc) - return read_umc_base_mask(pvt); - for_each_chip_select(cs, 0, pvt) { int reg0 = DCSB0 + (cs * 4); int reg1 = DCSB1 + (cs * 4); @@ -3185,7 +3182,6 @@ static void read_mc_regs(struct amd64_pvt *pvt) } skip: - read_dct_base_mask(pvt); determine_memory_type(pvt); @@ -3666,6 +3662,7 @@ static int dct_hw_info_get(struct amd64_pvt *pvt) return ret; dct_prep_chip_selects(pvt); + dct_read_base_mask(pvt); read_mc_regs(pvt); return 0; @@ -3678,6 +3675,7 @@ static int umc_hw_info_get(struct amd64_pvt *pvt) return -ENOMEM; umc_prep_chip_selects(pvt); + umc_read_base_mask(pvt); read_mc_regs(pvt); return 0; From patchwork Fri Jan 27 17:04:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 13119064 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52CB9C61D97 for ; Fri, 27 Jan 2023 17:05:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234883AbjA0RFo (ORCPT ); Fri, 27 Jan 2023 12:05:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234908AbjA0RFe (ORCPT ); Fri, 27 Jan 2023 12:05:34 -0500 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2062d.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e83::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BB3D1DBA0; Fri, 27 Jan 2023 09:05:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=med6Fjn9wsnfTF/aBRgZujymY86RLqe5JuZYj5osFXabJHgYfJxi+LuApiKKblHBeMBBhMWgOJcieHF/6nCl1sn2xzTM3yTYDluz/+nHzohkVCI0ISv/bKixDgnbAv9wfuNp/evQ3TOtzigFjBeCAFsBVwFugFl/tRku1gUYkUbw7DloEic/DeawZYVWJ0GJ/c8ypFkDlUldvSCm9TagN6ykk8CZpQKXttbY031XGGOVEd13X8YEHY8N/DOt9FQKuza8pdv76ugrfNRLJJB1zFm0E9WA3EK+4OPLeCrEPuigBmcN/mC4tXtun/ycgh2JFYoAhNieWYzEVadpptUtLA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=V5zIhcKDC1tqXiankphBpWnld9DLg/4DpD6SRlEY9Fk=; b=kdL2Go8Itx7e54eZvYEoMySQzHiUXe/vFQfbKi2eIoQhn6IdTVPF97HulBmjQbRNr/SUhrF9lKXlXYn9+o7zKxJ4PcENhvcRvcdJi4I5uMXoRv399Oe1br36qWCkD7WbY5jrghcQm2lJMiDqTP0IQpur67r+RqUuV9tLUgjDbWe5tCC39iVapssHkbKM57wucvNe8mznTvU8F6m059rxH20AmhaM+GbbEtLAyCs2pMdqbin466/06HQD5qdO52i4xtlINdnNEBS8ooEjvZBcA0XjF+58E0iNgLZ60GOMbWZcXnAKsFw0T6qbcrWE0NgT/trG/NXARD0ovYFjLigYzQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=V5zIhcKDC1tqXiankphBpWnld9DLg/4DpD6SRlEY9Fk=; b=GZ+53SbAZtT+Q7ZUcs5Nn1pNRlXJMP+5gID1zMp8GJWvpkt3trsDopZiSEUJe3VPnbuD06uv5ZIWsV8c+4OPD0BYGnB+Ox2CBJld8rcrwuiG1OricWBaQNx+Nm+QSDZpPbohSayuPoBbOOvz2owGg9mbyQ/dfe10HYQIq0/LLuE= Received: from BN8PR04CA0042.namprd04.prod.outlook.com (2603:10b6:408:d4::16) by MN0PR12MB6080.namprd12.prod.outlook.com (2603:10b6:208:3c8::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.25; Fri, 27 Jan 2023 17:04:37 +0000 Received: from BN8NAM11FT089.eop-nam11.prod.protection.outlook.com (2603:10b6:408:d4:cafe::58) by BN8PR04CA0042.outlook.office365.com (2603:10b6:408:d4::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.25 via Frontend Transport; Fri, 27 Jan 2023 17:04:37 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT089.mail.protection.outlook.com (10.13.176.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6023.16 via Frontend Transport; Fri, 27 Jan 2023 17:04:37 +0000 Received: from yaz-ethanolx.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 27 Jan 2023 11:04:35 -0600 From: Yazen Ghannam To: , CC: , , , Yazen Ghannam Subject: [PATCH v2 14/22] EDAC/amd64: Split determine_memory_type() into dct/umc functions Date: Fri, 27 Jan 2023 17:04:11 +0000 Message-ID: <20230127170419.1824692-15-yazen.ghannam@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230127170419.1824692-1-yazen.ghannam@amd.com> References: <20230127170419.1824692-1-yazen.ghannam@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT089:EE_|MN0PR12MB6080:EE_ X-MS-Office365-Filtering-Correlation-Id: 7e6c0dca-e3b0-4ccf-a90a-08db00889226 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QOTHtJmveHIxxqEjNGdDAjhQ7i/kh02Xr4vhPBvVy/QkRRVrpo0A0e9VSVm1e2XkfWQW/wzH15/6QEP5Czzy8lwN0bWHEQBEjTNPhyuYZee3xT7OEMnp55HMG+wBqJbveDNywKP1nMLyj8EunHJMRGBPLpY9gOSP/N9IHIjtGrA+ci1tRazIguLR7kBmxmCCBwW0AssCj4Gp8zIw0Ihccvh1KQ45R8sPbSjXQS/wut0KOANEJu7IuuvfV9H/Wn1NTjlH0HhHKO3oI9kOcRhzJDF6rcxRLTdMfsxSgrbA8iNVgOcGK6zlg7PQj0YoPjWiMs/1ZxNPPaoDALwRrtUpcxbG+IyfKN8lgmtogqO1Wwk6FxYAIPaW11mXbNA+VtJ05sXReogSxHLfzhaAOeBt8LToROCeORHVruI2cNuZOmp7gEnGrqDxV2Si7491TlFO/k7lV54wXUA2ou7h8LEoRB4W6RrQLG+zpIYaaS68GW/TYyExULgWpq7HYP+eAcjHR/C7hi5H5yyrSSjvNTdaUcALUTv1zl/UuNSaBVESebflFCV/3aGtvp1cGSWrdpmMmgxXG7hnWcBkHoUMCe5rksKZALeIDE4NtDCg0x+mgEVkqmJVvSQqLDmv79b71U2CXC20RVVqaKZ+uZU/kZSdNbktwBaVkj3c/Wtc7kgGzRavbiDOJ77axcwiWcL4PDMI98TxBrxAgIz4j7e5YqYbIEJlgEjPn8cEXWbO3KYR8kRf7vyXBByCRMTnJKvAc5OElNAFudv/XJhvBqgZlezbWQ== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230025)(4636009)(346002)(396003)(39860400002)(136003)(376002)(451199018)(46966006)(36840700001)(40470700004)(26005)(2616005)(4326008)(8676002)(70206006)(336012)(70586007)(7696005)(426003)(186003)(16526019)(47076005)(36756003)(82310400005)(2906002)(86362001)(83380400001)(8936002)(36860700001)(478600001)(40480700001)(966005)(54906003)(316002)(110136005)(1076003)(40460700003)(6666004)(41300700001)(82740400003)(5660300002)(81166007)(44832011)(356005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2023 17:04:37.0147 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7e6c0dca-e3b0-4ccf-a90a-08db00889226 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT089.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB6080 Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org From: Muralidhara M K ..and call them from their respective hw_info_get() paths. Call them after all other hardware registers have been saved, since the memory type for a device will be determined based on the saved information. Signed-off-by: Muralidhara M K Co-developed-by: Naveen Krishna Chatradhi Signed-off-by: Naveen Krishna Chatradhi [Rebased/reworked patch and reworded commit message] Co-developed-by: Yazen Ghannam Signed-off-by: Yazen Ghannam --- Link: https://lore.kernel.org/r/20220509145534.44912-9-yazen.ghannam@amd.com v1->v2: * Call functions directly instead of using pointers. drivers/edac/amd64_edac.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 9310c0fdeb22..0d0e563c99db 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -1735,7 +1735,7 @@ static void dct_read_base_mask(struct amd64_pvt *pvt) } } -static void determine_memory_type_df(struct amd64_pvt *pvt) +static void umc_determine_memory_type(struct amd64_pvt *pvt) { struct amd64_umc *umc; u32 i; @@ -1772,13 +1772,10 @@ static void determine_memory_type_df(struct amd64_pvt *pvt) } } -static void determine_memory_type(struct amd64_pvt *pvt) +static void dct_determine_memory_type(struct amd64_pvt *pvt) { u32 dram_ctrl, dcsm; - if (pvt->umc) - return determine_memory_type_df(pvt); - switch (pvt->fam) { case 0xf: if (pvt->ext_model >= K8_REV_F) @@ -1828,6 +1825,8 @@ static void determine_memory_type(struct amd64_pvt *pvt) WARN(1, KERN_ERR "%s: Family??? 0x%x\n", __func__, pvt->fam); pvt->dram_type = MEM_EMPTY; } + + edac_dbg(1, " DIMM type: %s\n", edac_mem_types[pvt->dram_type]); return; ddr3: @@ -3183,10 +3182,6 @@ static void read_mc_regs(struct amd64_pvt *pvt) skip: - determine_memory_type(pvt); - - if (!pvt->umc) - edac_dbg(1, " DIMM type: %s\n", edac_mem_types[pvt->dram_type]); determine_ecc_sym_sz(pvt); } @@ -3664,6 +3659,7 @@ static int dct_hw_info_get(struct amd64_pvt *pvt) dct_prep_chip_selects(pvt); dct_read_base_mask(pvt); read_mc_regs(pvt); + dct_determine_memory_type(pvt); return 0; } @@ -3677,6 +3673,7 @@ static int umc_hw_info_get(struct amd64_pvt *pvt) umc_prep_chip_selects(pvt); umc_read_base_mask(pvt); read_mc_regs(pvt); + umc_determine_memory_type(pvt); return 0; } From patchwork Fri Jan 27 17:04:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 13119077 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5714DC54EAA for ; Fri, 27 Jan 2023 17:06:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235083AbjA0RGz (ORCPT ); Fri, 27 Jan 2023 12:06:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234982AbjA0RGX (ORCPT ); Fri, 27 Jan 2023 12:06:23 -0500 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2057.outbound.protection.outlook.com [40.107.223.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7949E2684E; Fri, 27 Jan 2023 09:05:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g3FYDHJVVpRsLXCyK9lbigfyzPJsO0qunkygXHjBsdgj5xxvL8YW8dpdkQV6PBS9d/ISBHmsQTb/omq7hDCtFfTT2EuisEdankaIqeGl7pQEk8vtjYqNNG0J6NnzfxhzZa8AbCmGJSbzR9eDznhnCwP2Kn5l44ClA+OUaNuG66Xi4cM39+JEjs5izSvlOGDre/VT68zMd+ZHWc/V25ZD9xoISzAdOjv53/+W3azb+AqJxMB+XT/jTSA4l5rBQP7o5PZfvkRZbVP+pPB/L2zpI7bpjTA1CndRCUHscdU7Skw83q80F2eX9E2Cw3q4m8bn8p4N56NroNP/Yexxpu9PzQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ROeIX5lny5eSt8wgK5KhTZ+Q/2Q2xDc0dJ+L0hd62Zs=; b=boOtzy5ECjexxiQv3N5DcWrFWErbeOCeZhHzoFwijs7c5xKLH2Sc6rZaBlirXRWD5fNwHj84bdtW1UHfK+oyRboz4lyOC8goy0Kr7260BoxcweKyUlrGKsvQTFam1qgqcmNUWs2ZsgDttFq9N9cnQmwtdBrpNdq2MuhkidFNDrUjKNqI4HHyKaNVbTqsbJx13pYxmq8clVNBFn1Tz762nn/UFPqb73JbflOBDLS8a84H/AILfLrhY7fu2QcL3GMzxPhToP+3lMbdokusQ0OomFkg4VbYszxtozAdBDZ48oMXadPFl7XGPyEtntIZlM/tJjkETdyCYvnaBCtLV12pWw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ROeIX5lny5eSt8wgK5KhTZ+Q/2Q2xDc0dJ+L0hd62Zs=; b=SN8PFPwhroQwpnYYpgyE+s3KR0L4mt/ffnNCkV9846WrmhbYEF2496NsfM/kwatOalhD77wK1zuJvuM05lXGuzh1mZUAkMDQ4VA/Q5/vQycCictfot6qcQJTS0irTD1KY1uzvCppfvQjQ0EvnFsOBqcDGeB3R0u3cWSRajPoIdA= Received: from BN8PR04CA0049.namprd04.prod.outlook.com (2603:10b6:408:d4::23) by IA1PR12MB8237.namprd12.prod.outlook.com (2603:10b6:208:3f3::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.33; Fri, 27 Jan 2023 17:04:37 +0000 Received: from BN8NAM11FT089.eop-nam11.prod.protection.outlook.com (2603:10b6:408:d4:cafe::fc) by BN8PR04CA0049.outlook.office365.com (2603:10b6:408:d4::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.25 via Frontend Transport; Fri, 27 Jan 2023 17:04:37 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT089.mail.protection.outlook.com (10.13.176.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6023.16 via Frontend Transport; Fri, 27 Jan 2023 17:04:37 +0000 Received: from yaz-ethanolx.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 27 Jan 2023 11:04:36 -0600 From: Yazen Ghannam To: , CC: , , , Yazen Ghannam Subject: [PATCH v2 15/22] EDAC/amd64: Split read_mc_regs() into dct/umc functions Date: Fri, 27 Jan 2023 17:04:12 +0000 Message-ID: <20230127170419.1824692-16-yazen.ghannam@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230127170419.1824692-1-yazen.ghannam@amd.com> References: <20230127170419.1824692-1-yazen.ghannam@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT089:EE_|IA1PR12MB8237:EE_ X-MS-Office365-Filtering-Correlation-Id: 0c0f837d-8b11-41a2-570b-08db00889256 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IUc7ppeaMG6Uyfbm9vfnVjWy3YOeieXz0y7fXxZ95W++NbtdvpQDt/XyQ4brEeqQX3eizX+Kfm5Xj0AfGjwwV9RJeG5mzvJrascTi9LHvvW+V7tpShSE3mHJsWYW9qXwyfYbZI95ep0iEeYgIOpcVynBY1crtru9e/uw6/4uOkHA6/XFBpNfmlK202kwzNOvvE5mRA7rjMrKkxbZPX78QyWwJDfqqK+n99ZpuN95jQnBtzoem77Gx1rKbHWdcOly/tfJQZbQvOQ7t3Xqsv+/rpNZDsqCgs9utR4glwxkjZ2yODa6eXQpbcJvq+rCAtttCkRkDeF3bMYie6FtR3WRtUScu0rTApkANoZcx6+VNBF8mL5BjpcUfX5hnOJOQT4nlqvIW8CTo2gvqgaVIpUCxtl0K5PZaNeEbeexNPoLa97Z//IJn4LFuLfctfSkubDEZm41Xq7lMzLutBQ/j3bh1OEDxuC43sXc88z7izBin1FW8QfUItZHwEmIOZEOwbiICUNJQWKRC1wJK4bMtR2D/M4zRHwgaNSMBby9wwtyGsxS9a4iN25gUSQyq85mVpS/lojUZ+K2nPFuaeNCk/hYlH63rCr2kKBBXBUENaIk19VbW2stOFtb5vf5bI3w/d7G6vri02+QJFO7hlWM4+DR0WVBNHypKgSRMau0UcXDyzCrML8aDJ7HUNOhXFWau1aFFxkqu9z4MUZhP11ewqgmrxEmQHDv7ewuKGEZr0rOA+tkcmd1KZ3rHE152TaSzjRr/RVNkKdUP/W5SYvdd+AiZA== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230025)(4636009)(136003)(39860400002)(396003)(346002)(376002)(451199018)(36840700001)(46966006)(40470700004)(186003)(86362001)(16526019)(1076003)(26005)(478600001)(6666004)(966005)(70586007)(70206006)(426003)(47076005)(8676002)(5660300002)(44832011)(40460700003)(356005)(40480700001)(41300700001)(8936002)(82740400003)(7696005)(2906002)(36860700001)(36756003)(4326008)(110136005)(82310400005)(81166007)(83380400001)(316002)(54906003)(2616005)(336012)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2023 17:04:37.3428 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0c0f837d-8b11-41a2-570b-08db00889256 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT089.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB8237 Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org From: Muralidhara M K ...and call them from their respective hw_info_get() paths. ECC symbol size is not needed on UMC systems, so determine_ecc_sym_sz() is left out of the UMC path. Signed-off-by: Muralidhara M K Co-developed-by: Naveen Krishna Chatradhi Signed-off-by: Naveen Krishna Chatradhi [Rebased/reworked patch and reworded commit message] Co-developed-by: Yazen Ghannam Signed-off-by: Yazen Ghannam --- Link: https://lore.kernel.org/r/20220509145534.44912-11-yazen.ghannam@amd.com v1->v2: * Call functions directly instead of using pointers. drivers/edac/amd64_edac.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 0d0e563c99db..757d35fad2a6 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -3089,7 +3089,7 @@ static void determine_ecc_sym_sz(struct amd64_pvt *pvt) /* * Retrieve the hardware registers of the memory controller. */ -static void __read_mc_regs_df(struct amd64_pvt *pvt) +static void umc_read_mc_regs(struct amd64_pvt *pvt) { u8 nid = pvt->mc_node_id; struct amd64_umc *umc; @@ -3113,7 +3113,7 @@ static void __read_mc_regs_df(struct amd64_pvt *pvt) * Retrieve the hardware registers of the memory controller (this includes the * 'Address Map' and 'Misc' device regs) */ -static void read_mc_regs(struct amd64_pvt *pvt) +static void dct_read_mc_regs(struct amd64_pvt *pvt) { unsigned int range; u64 msr_val; @@ -3134,12 +3134,6 @@ static void read_mc_regs(struct amd64_pvt *pvt) edac_dbg(0, " TOP_MEM2 disabled\n"); } - if (pvt->umc) { - __read_mc_regs_df(pvt); - - goto skip; - } - amd64_read_pci_cfg(pvt->F3, NBCAP, &pvt->nbcap); read_dram_ctl_register(pvt); @@ -3180,9 +3174,6 @@ static void read_mc_regs(struct amd64_pvt *pvt) amd64_read_dct_pci_cfg(pvt, 1, DCHR0, &pvt->dchr1); } -skip: - - determine_ecc_sym_sz(pvt); } @@ -3658,7 +3649,7 @@ static int dct_hw_info_get(struct amd64_pvt *pvt) dct_prep_chip_selects(pvt); dct_read_base_mask(pvt); - read_mc_regs(pvt); + dct_read_mc_regs(pvt); dct_determine_memory_type(pvt); return 0; @@ -3672,7 +3663,7 @@ static int umc_hw_info_get(struct amd64_pvt *pvt) umc_prep_chip_selects(pvt); umc_read_base_mask(pvt); - read_mc_regs(pvt); + umc_read_mc_regs(pvt); umc_determine_memory_type(pvt); return 0; From patchwork Fri Jan 27 17:04:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 13119065 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5AAFC54EAA for ; Fri, 27 Jan 2023 17:05:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234885AbjA0RFs (ORCPT ); Fri, 27 Jan 2023 12:05:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234915AbjA0RFf (ORCPT ); Fri, 27 Jan 2023 12:05:35 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on20603.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e88::603]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F75B4F353; Fri, 27 Jan 2023 09:05:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HA6OdXntSpgM+tF8J6bCP0vlUbsEKV/nQxoOQ59TpXhzmGH2a/drVQutbmIsvEPq/EHFQrYQOMR3WMflg8RRCGsa3I8gsmDdgG7dfQVPJUbcneWXmONcMcISJykxJtzL1tyHGuh/0kv7eq7nPcqWRdP31vCKvMP6nkiqx/2psxH3jtiCpjt739zxc6cu5zoZC0Fzhys3FvwvyCBkRYhN+xMaDKjoRssFEc4JXlYwMWL3KkugCn2PbL2jwx9dJjNOKSjXFAnnLossv0OTHID5FnrMvnEq4Q6dpuWq6lNePmYoAAeV/1LABAgSRssZ12AL0mSdk0fotUH5qNX6+Am49w== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=p7w12skH6KD0cJOo1BHf+ijczs+5VKURFoXGVYzrId0=; b=ek9RkDnXcS+B0Fv+4wNZvLiJQIVgAuGsH2d9exvJuL3BByD9K7uQLNINSrw/ABSUqXY0rfbrMz8MzwxArsVvB8wC/NVxygBb/h2zOuRMeU1a6vQhhi8Cl6RRvkcaNwj5PK19iTVBaWYbN2qBXH900nr9aWgwe49xG0QRh1op2DlpD1lJ0mfcv/rCa0aODe70U9oOto2ecrCxt3AbDax5vyVsb3TQVKVc5SEV/jNN8BW2rX+NQyWCzRU4uNuUXNEku/DfcZTtirPX9Po62f+EYgdGkibxh1EiZPar8jPAfVh3hiObgr2iG8CH7ykMID2D2BLD4KdP3fN34/G8qwXh0g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=p7w12skH6KD0cJOo1BHf+ijczs+5VKURFoXGVYzrId0=; b=se0X02cTCERhbHsyMvk9i8YbJDaUu/+lrifMTZquYP4rNxD5RBMHPQE8qiaJ1UGP8kowBQLgurkU3wKH3LGWfVuUhC57ePvVvehMWfBCkl8t9riT+BBCGm4JPo/PpWZobGbmD6aIpDqKcrFsfFwMOklHITHNm2dxIws/RpgM73o= Received: from BN9PR03CA0477.namprd03.prod.outlook.com (2603:10b6:408:139::32) by MN2PR12MB4221.namprd12.prod.outlook.com (2603:10b6:208:1d2::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.22; Fri, 27 Jan 2023 17:04:37 +0000 Received: from BN8NAM11FT016.eop-nam11.prod.protection.outlook.com (2603:10b6:408:139:cafe::6f) by BN9PR03CA0477.outlook.office365.com (2603:10b6:408:139::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.23 via Frontend Transport; Fri, 27 Jan 2023 17:04:37 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT016.mail.protection.outlook.com (10.13.176.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6043.23 via Frontend Transport; Fri, 27 Jan 2023 17:04:37 +0000 Received: from yaz-ethanolx.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 27 Jan 2023 11:04:36 -0600 From: Yazen Ghannam To: , CC: , , , Yazen Ghannam Subject: [PATCH v2 16/22] EDAC/amd64: Split ecc_enabled() into dct/umc functions Date: Fri, 27 Jan 2023 17:04:13 +0000 Message-ID: <20230127170419.1824692-17-yazen.ghannam@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230127170419.1824692-1-yazen.ghannam@amd.com> References: <20230127170419.1824692-1-yazen.ghannam@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT016:EE_|MN2PR12MB4221:EE_ X-MS-Office365-Filtering-Correlation-Id: 0a0c78a5-6ea7-4bd4-1e98-08db00889259 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CWJ3glBxyPM4Avt9XevRke0EPbSa6cZDXR8eF5L7exAxT7Bw66Wx6+qgDRh1lBOzIEtiv5/k3ww+l+ykjNOZbHwmruYGj7vs/aK2zkaDfcIKKIa0gAkdMPZ07f51VTCD7ALpczjAXrZ2iOepP5CBB9jXFB93I+s69W/c6LsPFLofzG0svsg3XQjjfo26lhVZU1N0Vj2zG/EXio9hLMLp0FuVbSe/+lx8uCLdFkIAcufskHT3m8JhLfETDZumFhuL+OTjUhHbzGE8lt73cJQYDtCtZ6+sIjL9JgH9DhMGUiEXaWTKzyrFze2zjORQqQ/D7AJDbykA2BsdGUl3OKyvdy5/J/+zphuBVrCk54hodpsAtfieIrn6gW9wa6gwyJgeGJyMIDLwqAKJPUDkM18U0IxxOY4iYnMcxTZ5Cd1AD2/eHTU5pCl0d0zqJhDroMGN5u0zTq500Rw/M36LiGzn0zFz4fBSG326Um533NxM+VEEo62Vd4+rB32QkRZwS7wAo29NhAfVW/gfdrETzoR83AwQQusBlw1RhOWw24JY4SnjC8tJJ/l3sTiuQzVC0vP8znKwnok1kdLFu39AbPhUn55X78fkn7Y7lxrPWWK3M4Pp5/krtaWL22KqgCHLvqznBscr3PuSck8oTJsD5DzMcmRXF0XMpN/gOT5p5usI12tWg91sicvW3kg7BMOdSRJ6Ntp3z0xXF5MkXv5NiHVBTK62lH7/E1OfVNk5Ogp1LyCERfNvKa+xxFL1ftPGsis6WR0yJ/I5b3k0ZKpp38uEHw== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230025)(4636009)(136003)(396003)(39860400002)(346002)(376002)(451199018)(40470700004)(36840700001)(46966006)(7696005)(16526019)(186003)(26005)(478600001)(966005)(47076005)(2616005)(336012)(82310400005)(426003)(83380400001)(6666004)(316002)(54906003)(41300700001)(8676002)(81166007)(356005)(1076003)(70206006)(82740400003)(110136005)(8936002)(44832011)(40460700003)(86362001)(4326008)(5660300002)(70586007)(36756003)(40480700001)(36860700001)(2906002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2023 17:04:37.3454 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0a0c78a5-6ea7-4bd4-1e98-08db00889259 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT016.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4221 Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org From: Muralidhara M K ...and call them using a function pointer in pvt->ops. The "ECC enabled" check is done outside of the hardware information gathering done in hw_info_get(). So a high-level function pointer is needed to separate the legacy and modern paths. No functional change is intended. Signed-off-by: Muralidhara M K Co-developed-by: Naveen Krishna Chatradhi Signed-off-by: Naveen Krishna Chatradhi [Rebased/reworked patch and reworded commit message] Co-developed-by: Yazen Ghannam Signed-off-by: Yazen Ghannam --- Link: https://lore.kernel.org/r/20220509145534.44912-12-yazen.ghannam@amd.com v1->v2: * Update commit message. drivers/edac/amd64_edac.c | 69 ++++++++++++++++++++++----------------- drivers/edac/amd64_edac.h | 1 + 2 files changed, 40 insertions(+), 30 deletions(-) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 757d35fad2a6..ecffe2f1ea9a 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -3527,52 +3527,59 @@ static void restore_ecc_error_reporting(struct ecc_settings *s, u16 nid, amd64_warn("Error restoring NB MCGCTL settings!\n"); } -static bool ecc_enabled(struct amd64_pvt *pvt) +static bool dct_ecc_enabled(struct amd64_pvt *pvt) { u16 nid = pvt->mc_node_id; bool nb_mce_en = false; - u8 ecc_en = 0, i; + u8 ecc_en = 0; u32 value; - if (boot_cpu_data.x86 >= 0x17) { - u8 umc_en_mask = 0, ecc_en_mask = 0; - struct amd64_umc *umc; + amd64_read_pci_cfg(pvt->F3, NBCFG, &value); - for_each_umc(i) { - umc = &pvt->umc[i]; + ecc_en = !!(value & NBCFG_ECC_ENABLE); - /* Only check enabled UMCs. */ - if (!(umc->sdp_ctrl & UMC_SDP_INIT)) - continue; + nb_mce_en = nb_mce_bank_enabled_on_node(nid); + if (!nb_mce_en) + edac_dbg(0, "NB MCE bank disabled, set MSR 0x%08x[4] on node %d to enable.\n", + MSR_IA32_MCG_CTL, nid); - umc_en_mask |= BIT(i); + edac_dbg(3, "Node %d: DRAM ECC %s.\n", nid, (ecc_en ? "enabled" : "disabled")); - if (umc->umc_cap_hi & UMC_ECC_ENABLED) - ecc_en_mask |= BIT(i); - } + if (!ecc_en || !nb_mce_en) + return false; + else + return true; +} - /* Check whether at least one UMC is enabled: */ - if (umc_en_mask) - ecc_en = umc_en_mask == ecc_en_mask; - else - edac_dbg(0, "Node %d: No enabled UMCs.\n", nid); +static bool umc_ecc_enabled(struct amd64_pvt *pvt) +{ + u8 umc_en_mask = 0, ecc_en_mask = 0; + u16 nid = pvt->mc_node_id; + struct amd64_umc *umc; + u8 ecc_en = 0, i; - /* Assume UMC MCA banks are enabled. */ - nb_mce_en = true; - } else { - amd64_read_pci_cfg(pvt->F3, NBCFG, &value); + for_each_umc(i) { + umc = &pvt->umc[i]; + + /* Only check enabled UMCs. */ + if (!(umc->sdp_ctrl & UMC_SDP_INIT)) + continue; - ecc_en = !!(value & NBCFG_ECC_ENABLE); + umc_en_mask |= BIT(i); - nb_mce_en = nb_mce_bank_enabled_on_node(nid); - if (!nb_mce_en) - edac_dbg(0, "NB MCE bank disabled, set MSR 0x%08x[4] on node %d to enable.\n", - MSR_IA32_MCG_CTL, nid); + if (umc->umc_cap_hi & UMC_ECC_ENABLED) + ecc_en_mask |= BIT(i); } + /* Check whether at least one UMC is enabled: */ + if (umc_en_mask) + ecc_en = umc_en_mask == ecc_en_mask; + else + edac_dbg(0, "Node %d: No enabled UMCs.\n", nid); + edac_dbg(3, "Node %d: DRAM ECC %s.\n", nid, (ecc_en ? "enabled" : "disabled")); - if (!ecc_en || !nb_mce_en) + if (!ecc_en) return false; else return true; @@ -3678,6 +3685,7 @@ static void hw_info_put(struct amd64_pvt *pvt) static struct low_ops umc_ops = { .hw_info_get = umc_hw_info_get, + .ecc_enabled = umc_ecc_enabled, }; /* Use Family 16h versions for defaults and adjust as needed below. */ @@ -3685,6 +3693,7 @@ static struct low_ops dct_ops = { .map_sysaddr_to_csrow = f1x_map_sysaddr_to_csrow, .dbam_to_cs = f16_dbam_to_chip_select, .hw_info_get = dct_hw_info_get, + .ecc_enabled = dct_ecc_enabled, }; static int per_family_init(struct amd64_pvt *pvt) @@ -3910,7 +3919,7 @@ static int probe_one_instance(unsigned int nid) goto err_enable; } - if (!ecc_enabled(pvt)) { + if (!pvt->ops->ecc_enabled(pvt)) { ret = -ENODEV; if (!ecc_enable_override) diff --git a/drivers/edac/amd64_edac.h b/drivers/edac/amd64_edac.h index 00b3f32e3cbb..103cd38a6302 100644 --- a/drivers/edac/amd64_edac.h +++ b/drivers/edac/amd64_edac.h @@ -467,6 +467,7 @@ struct low_ops { int (*dbam_to_cs)(struct amd64_pvt *pvt, u8 dct, unsigned int cs_mode, int cs_mask_nr); int (*hw_info_get)(struct amd64_pvt *pvt); + bool (*ecc_enabled)(struct amd64_pvt *pvt); }; int __amd64_read_pci_cfg_dword(struct pci_dev *pdev, int offset, From patchwork Fri Jan 27 17:04:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 13119066 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88E64C61D97 for ; Fri, 27 Jan 2023 17:05:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234934AbjA0RFu (ORCPT ); Fri, 27 Jan 2023 12:05:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234892AbjA0RFn (ORCPT ); Fri, 27 Jan 2023 12:05:43 -0500 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on20610.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe5b::610]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F90B3C3C; Fri, 27 Jan 2023 09:05:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dSbNQQZ2NqNbBsjmcTaQ6aaQVJN2dS0PsdefXvQaH8WKhGCZsTIAz82b8ZBcI70CL2Xcz9UzZ3Nq6tN4LbUk2bkKA6+MOLXS+gNqKZTQTDQzEObyEODdwHRsEq6jqkmswwAfVxHvoycprKg4Bn5r1ZCccut6ZDu044P3m+xpifi/MqD1+ajduZgoemZ0xQbDo2Yw+Te/SzoebXcQ1ilhaJWVwMjIfiHbeLBU8D4tGgT4jku6FgV6NCdwbA0tD+jc0pxccuTU8mIx7JcUKjFFEKn5awacNgHPR5zLsc1Ns2q9elOBo5Qoa0Zv/Aipo869P8b2hqkkYLqUDqdomPVK0A== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ayhba4cEA7/yo1GcA4RjdHbPDbQhVhhgqHmosB+Rqhw=; b=TBJBhTmWU4g5LgIXjFV+Ds+mdudhaOJRSyROs01x8wUjrBsXCoonvf/3CsiIFTzL9fsZRt0eRZCWKaqvjxa1w/F4wtP89Qct4mS+P2wBNqoYTB0VnO/UNMlndOaYYUHMHrIr74uNO9qz5Y5M+t8WeH00ityg5xAW8Vcf6NPJlOjsYK7/WlNzlfyXEMq5P7q9dhHsqWpc6nBpMAofZEpMrSCmI3Jph/I9fJAZjfzhnJiVlqErEEMsXX0BRVORe4UPyjurnpVMiEduy9ku8nakKY9FTgfYkgf3J8EHA7l2yoeSe2NbqPbmfpFF79Rv7b5Sknp+AG7/qlZUYl17SM83lQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ayhba4cEA7/yo1GcA4RjdHbPDbQhVhhgqHmosB+Rqhw=; b=nuxYrSRYXk46LSZa2y662uvgjzNsa8j0qeDeI7e3eAmp2MFAG0mJzYWL4AFCAs3UV3UhdyyDZ55gIb/fmM6QzP9QEGghGALub9qCejwzMlgUD+ndE3REY/2Uxy+fvNPhMSRzstu+4fIJzqdLFWUOwAGZPfV02OrJF4TGHqL235I= Received: from BN9PR03CA0467.namprd03.prod.outlook.com (2603:10b6:408:139::22) by DM4PR12MB5818.namprd12.prod.outlook.com (2603:10b6:8:62::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.22; Fri, 27 Jan 2023 17:04:37 +0000 Received: from BN8NAM11FT016.eop-nam11.prod.protection.outlook.com (2603:10b6:408:139:cafe::3e) by BN9PR03CA0467.outlook.office365.com (2603:10b6:408:139::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.25 via Frontend Transport; Fri, 27 Jan 2023 17:04:37 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT016.mail.protection.outlook.com (10.13.176.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6043.23 via Frontend Transport; Fri, 27 Jan 2023 17:04:37 +0000 Received: from yaz-ethanolx.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 27 Jan 2023 11:04:36 -0600 From: Yazen Ghannam To: , CC: , , , Yazen Ghannam Subject: [PATCH v2 17/22] EDAC/amd64: Split setup_mci_misc_attrs() into dct/umc functions Date: Fri, 27 Jan 2023 17:04:14 +0000 Message-ID: <20230127170419.1824692-18-yazen.ghannam@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230127170419.1824692-1-yazen.ghannam@amd.com> References: <20230127170419.1824692-1-yazen.ghannam@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT016:EE_|DM4PR12MB5818:EE_ X-MS-Office365-Filtering-Correlation-Id: 9168336e-46f9-4d7c-7eec-08db0088927a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JjTrKWd9KYOmAZsLh3d9hFG7TcTzXa/ddR7Y+OvudkAOuRk2itH389bp7KWKzRlHEWtx+YMGOcKz950fX5RTn3C8Ajyakp3VRquuGPkthtpyC7m0tXax2bPIrdHMWeHnoxglKSmtZAcz8KlAAGGINiyBc62qSaHv36xXuCdOUnGyzGlVFV9D1t3rs91ghlR0w2QpRA9Kw45DPBOIztbeoobYn5y7rOpV4406+hlwpXiOnDcCgvzQdtuNd0wUrmGm7L1E3eQOnYueWNV+M695jhkHYZThjQ23w6I7ogeX6IMa7xCWGAWo3rDU/1ar8jlpJaPomxNa24CisBegKFhHyi2N1y7gq2h2KeeXGU30XKXTA9WzBtN6NfNCGeiq9z6SCSnjqa/lmFhNCLSvuA+B6UdUU8yRUqPEKeUF4T04erzt86iX41qVpnfI2ImeuDBpDV3Njx6rK2m7n04HcbJEHtRF3kUDl/ygKYOuoj+JzeAvOAZCf+UrGxSjMmpcOpUTsyixbJ+9VCNTjoQovDxosv+Jdoq1tjEEuhdu/16fUHNAIWS/t35ESFSOLvRJri4P2l8B/zfeui+8E+tEYHT9RhfyNE2b4hqwrhMOymSkWn2B9Qt0FkrjbbxLEOA8OlkVtfe054sZMDy0dIXOLXVaxa/jcrABCboyzpFotFNvrDTP7nv3iJ8X8lLZGBjK4uYQ1gNwmsAifzSpKiJCOynFrWVQaYsq7/OiwYQkdjlhkGcpIScL41GqPYwl5o5tR2Xn6HoWQm0NYBv2GkivRTqN5g== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230025)(4636009)(136003)(396003)(39860400002)(346002)(376002)(451199018)(40470700004)(36840700001)(46966006)(7696005)(16526019)(186003)(26005)(478600001)(966005)(47076005)(2616005)(336012)(82310400005)(426003)(83380400001)(6666004)(316002)(54906003)(41300700001)(8676002)(81166007)(356005)(1076003)(70206006)(82740400003)(110136005)(8936002)(44832011)(40460700003)(86362001)(4326008)(5660300002)(70586007)(36756003)(40480700001)(36860700001)(2906002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2023 17:04:37.5642 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9168336e-46f9-4d7c-7eec-08db0088927a X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT016.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5818 Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org From: Muralidhara M K The init_one_instance() path is shared between legacy and modern systems. So add the new functions to a function pointer in pvt->ops. No functional change is intended. Signed-off-by: Muralidhara M K Co-developed-by: Naveen Krishna Chatradhi Signed-off-by: Naveen Krishna Chatradhi [Rebased/reworked patch and reworded commit message] Co-developed-by: Yazen Ghannam Signed-off-by: Yazen Ghannam --- Link: https://lore.kernel.org/r/20220509145534.44912-15-yazen.ghannam@amd.com v1->v2: * Split function instead of just defining function pointer. drivers/edac/amd64_edac.c | 37 ++++++++++++++++++++++++------------- drivers/edac/amd64_edac.h | 1 + 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index ecffe2f1ea9a..f9254d8da5a3 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -3616,22 +3616,18 @@ 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) +static void dct_setup_mci_misc_attrs(struct mem_ctl_info *mci) { struct amd64_pvt *pvt = mci->pvt_info; mci->mtype_cap = MEM_FLAG_DDR2 | MEM_FLAG_RDDR2; mci->edac_ctl_cap = EDAC_FLAG_NONE; - if (pvt->umc) { - f17h_determine_edac_ctl_cap(mci, pvt); - } else { - if (pvt->nbcap & NBCAP_SECDED) - mci->edac_ctl_cap |= EDAC_FLAG_SECDED; + if (pvt->nbcap & NBCAP_SECDED) + mci->edac_ctl_cap |= EDAC_FLAG_SECDED; - if (pvt->nbcap & NBCAP_CHIPKILL) - mci->edac_ctl_cap |= EDAC_FLAG_S4ECD4ED; - } + if (pvt->nbcap & NBCAP_CHIPKILL) + mci->edac_ctl_cap |= EDAC_FLAG_S4ECD4ED; mci->edac_cap = determine_edac_cap(pvt); mci->mod_name = EDAC_MOD_STR; @@ -3639,14 +3635,27 @@ static void setup_mci_misc_attrs(struct mem_ctl_info *mci) mci->dev_name = pci_name(pvt->F3); mci->ctl_page_to_phys = NULL; - if (pvt->fam >= 0x17) - return; - /* memory scrubber interface */ mci->set_sdram_scrub_rate = set_scrub_rate; mci->get_sdram_scrub_rate = get_scrub_rate; } +static void umc_setup_mci_misc_attrs(struct mem_ctl_info *mci) +{ + struct amd64_pvt *pvt = mci->pvt_info; + + mci->mtype_cap = MEM_FLAG_DDR4 | MEM_FLAG_RDDR4; + mci->edac_ctl_cap = EDAC_FLAG_NONE; + + f17h_determine_edac_ctl_cap(mci, pvt); + + mci->edac_cap = determine_edac_cap(pvt); + mci->mod_name = EDAC_MOD_STR; + mci->ctl_name = pvt->ctl_name; + mci->dev_name = pci_name(pvt->F3); + mci->ctl_page_to_phys = NULL; +} + static int dct_hw_info_get(struct amd64_pvt *pvt) { int ret = reserve_mc_sibling_devs(pvt, pvt->f1_id, pvt->f2_id); @@ -3686,6 +3695,7 @@ static void hw_info_put(struct amd64_pvt *pvt) static struct low_ops umc_ops = { .hw_info_get = umc_hw_info_get, .ecc_enabled = umc_ecc_enabled, + .setup_mci_misc_attrs = umc_setup_mci_misc_attrs, }; /* Use Family 16h versions for defaults and adjust as needed below. */ @@ -3694,6 +3704,7 @@ static struct low_ops dct_ops = { .dbam_to_cs = f16_dbam_to_chip_select, .hw_info_get = dct_hw_info_get, .ecc_enabled = dct_ecc_enabled, + .setup_mci_misc_attrs = dct_setup_mci_misc_attrs, }; static int per_family_init(struct amd64_pvt *pvt) @@ -3856,7 +3867,7 @@ static int init_one_instance(struct amd64_pvt *pvt) mci->pvt_info = pvt; mci->pdev = &pvt->F3->dev; - setup_mci_misc_attrs(mci); + pvt->ops->setup_mci_misc_attrs(mci); if (init_csrows(mci)) mci->edac_cap = EDAC_FLAG_NONE; diff --git a/drivers/edac/amd64_edac.h b/drivers/edac/amd64_edac.h index 103cd38a6302..1fb39d7981a2 100644 --- a/drivers/edac/amd64_edac.h +++ b/drivers/edac/amd64_edac.h @@ -468,6 +468,7 @@ struct low_ops { unsigned int cs_mode, int cs_mask_nr); int (*hw_info_get)(struct amd64_pvt *pvt); bool (*ecc_enabled)(struct amd64_pvt *pvt); + void (*setup_mci_misc_attrs)(struct mem_ctl_info *mci); }; int __amd64_read_pci_cfg_dword(struct pci_dev *pdev, int offset, From patchwork Fri Jan 27 17:04:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 13119068 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F479C61D97 for ; Fri, 27 Jan 2023 17:06:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235031AbjA0RGF (ORCPT ); Fri, 27 Jan 2023 12:06:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234947AbjA0RFn (ORCPT ); Fri, 27 Jan 2023 12:05:43 -0500 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on20605.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e8a::605]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B91314FCE8; Fri, 27 Jan 2023 09:05:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=URkDvZ2NO2v7ZrOAu2DxV8wCJOnH46rsDz8lSz5NZiN53nJ6EizuJLsQCHhx23xkgsYCkJ0drWZ3XFLXcm+5LYEgjOsWV+NdLtVCT846l05oWt6WkMGBInjJpy0vIwzsXWLFQpa4RKSyN5NRZYHILoT/TjptntPfpydwqKwcDbtdVsdnAlsV3Lo+2xwYApfyIqGq0IOHljFd7auPxLXNpwjVkNU/8m2UVCfu6mvzEKCqu+MEcZ6aXo199dBOCwcEE257y8oYzAkg0tURe1RwCgH3THws7o8+lvOdrKqqVP5lOx0zwFGuVGPUhGqA4peUwb1iOmxoXf0ErW9NwX582A== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=odn/2RXcMR6jw4C3k6Vwm4w2vPADguM1/yBj1IXt2Ig=; b=A6dfjGWG5VOuth9237XEEBJ/lXmQjSvcxaCPn7fX8ozjp0ophNEC+Pawcw7h01HzT6BbrWxT4oZ5ql8dm7VxzoXLoPHTWaUBkG/lv7Oh0LYBMqZk+PElSFnxjrDx9Mn2u7m5A0H1Ir0hueCu7ICFwXMzy/OtIlh5dXTlZusL9GzOC0bCj6mM6rbrNZ0VQv5paEkFSkfBDFSE5nigm3Z/vUCxfRxUYVcNlixEOgAfvSX8wEcOqX31bAolYaJ5vLayXUK3+VjALutTTgdXe7SVt2PFzMEZxYP4bO6aS0m9MazatyN0IRQHrAEJvX63l5Aon06buUfu61LLiCKjmaw8zw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=odn/2RXcMR6jw4C3k6Vwm4w2vPADguM1/yBj1IXt2Ig=; b=b6FduLNPYDNxiUsC6oAG51W6w9YXeRuN07oOiwcDGt6oJsmEn+IJz0hW6Z0dG+jhix2VDt24qMyuSuvTNiw3ThsT+7ih5jsMvaILHQo875QU/iOvqEGEHfkWGWCxVi8UKDL35bRh8ifnpzkAzeycJ2hzllPXetsobdtyAZ21r0I= Received: from BN8PR04CA0057.namprd04.prod.outlook.com (2603:10b6:408:d4::31) by CY8PR12MB7707.namprd12.prod.outlook.com (2603:10b6:930:86::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.22; Fri, 27 Jan 2023 17:04:37 +0000 Received: from BN8NAM11FT089.eop-nam11.prod.protection.outlook.com (2603:10b6:408:d4:cafe::99) by BN8PR04CA0057.outlook.office365.com (2603:10b6:408:d4::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.25 via Frontend Transport; Fri, 27 Jan 2023 17:04:37 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT089.mail.protection.outlook.com (10.13.176.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6023.16 via Frontend Transport; Fri, 27 Jan 2023 17:04:37 +0000 Received: from yaz-ethanolx.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 27 Jan 2023 11:04:37 -0600 From: Yazen Ghannam To: , CC: , , , Yazen Ghannam Subject: [PATCH v2 18/22] EDAC/amd64: Rename f17h_determine_edac_ctl_cap() Date: Fri, 27 Jan 2023 17:04:15 +0000 Message-ID: <20230127170419.1824692-19-yazen.ghannam@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230127170419.1824692-1-yazen.ghannam@amd.com> References: <20230127170419.1824692-1-yazen.ghannam@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT089:EE_|CY8PR12MB7707:EE_ X-MS-Office365-Filtering-Correlation-Id: 043998a6-466f-4af2-406c-08db00889281 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hnJI/g7pA1OuqBjQQrOGuG55B16w6v/pZrxpqQAlOunTI1H3GgAcpoFp1rYEoUfagQD4imxeoeHSD2ZNByLUuVJzOnrGAh2OPUrAx5Q91zwutY4YkjawHoxox40KHeYxQoc32+Xhp4rINwTyUcQbeLq3HpwZ9D2XF/c2KTYec1tGiYXnwbrFz6NVA2Q+evsB5SeCC8gpV9Z/cVslxsmqScet3zK65PhlIicHyk4KV/OZ4T58wEXwHqr7lvlGuTTIT4SflBFwJToxoFJqFKtmtiG6xrkNUD8OyBklgT9AZJLVuVmA50DbhboMEibsg9JrS0fnfS7CF9B9pRakPNSSLkVY5nQzLjtYy5OE6C8irEgawfB/5X/GYLFw/MLi9SnhqhxwkFOcK1ApVfoiwGAiBiq6+Ke9AgnK3RvkK9FdaeHclVMINy3hwt5pWhsZ4V8j1ZNNoiIKVgKzC8Ht8OkmUfwX42+RYtd+7/Xqn/2PJoN3gvddXb8mTvzTMoD0LNj73z4beeqhtaW6Wjn/yjc185NuuYOKcAGeUQccT5PgtNI0No27FvjySq20doEG5ughs5UtkF87hSIMsu72dBev9M3gTqFGfMXIt/U9/IzkMi72UJB52ZiY0vPshXrqcmU9QNNIEGLycWxHdNqsmmBB4mwngF62VxzD/Gpo6zZaR5KJHCI5SDck8V9esbO/lqRjILhBXPmAgcSqjQP6dC4myXKrGcibi9joJOH7fiQC7mJoTMx0aMBPAoNEPHUU9FfCY6Elr35KW79kM0rZBkBgrA== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230025)(4636009)(376002)(346002)(136003)(396003)(39860400002)(451199018)(46966006)(36840700001)(40470700004)(6666004)(356005)(110136005)(54906003)(41300700001)(81166007)(70206006)(8676002)(70586007)(40480700001)(4326008)(86362001)(40460700003)(36756003)(44832011)(8936002)(5660300002)(36860700001)(2906002)(1076003)(316002)(82740400003)(16526019)(26005)(966005)(186003)(7696005)(478600001)(426003)(83380400001)(82310400005)(47076005)(336012)(2616005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2023 17:04:37.6084 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 043998a6-466f-4af2-406c-08db00889281 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT089.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7707 Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org ...to match the "umc_" prefix convention. No functional change is intended. Signed-off-by: Yazen Ghannam --- Link: https://lore.kernel.org/r/20220509145534.44912-1-yazen.ghannam@amd.com v1->v2: * New in v2. drivers/edac/amd64_edac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index f9254d8da5a3..1062cb56a462 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -3586,7 +3586,7 @@ static bool umc_ecc_enabled(struct amd64_pvt *pvt) } static inline void -f17h_determine_edac_ctl_cap(struct mem_ctl_info *mci, struct amd64_pvt *pvt) +umc_determine_edac_ctl_cap(struct mem_ctl_info *mci, struct amd64_pvt *pvt) { u8 i, ecc_en = 1, cpk_en = 1, dev_x4 = 1, dev_x16 = 1; @@ -3647,7 +3647,7 @@ static void umc_setup_mci_misc_attrs(struct mem_ctl_info *mci) mci->mtype_cap = MEM_FLAG_DDR4 | MEM_FLAG_RDDR4; mci->edac_ctl_cap = EDAC_FLAG_NONE; - f17h_determine_edac_ctl_cap(mci, pvt); + umc_determine_edac_ctl_cap(mci, pvt); mci->edac_cap = determine_edac_cap(pvt); mci->mod_name = EDAC_MOD_STR; From patchwork Fri Jan 27 17:04:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 13119069 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0B23C54EAA for ; Fri, 27 Jan 2023 17:06:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235050AbjA0RGG (ORCPT ); Fri, 27 Jan 2023 12:06:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234942AbjA0RFn (ORCPT ); Fri, 27 Jan 2023 12:05:43 -0500 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on20627.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe59::627]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 324AC2B091; Fri, 27 Jan 2023 09:05:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cLadVZwXgcsaRGS5TMx0HlHWgKGpdLzI5QE07PwxUfdWF2hBeNrJgmv/QRdQ3uE5PYihXVPrOzG6OcdyoWa9JnlrYr2DRR026kSg4Sehh/XVOH7RUgdQ66EuQvL8P/jAtlp9hYcZj//gboQ04ovrFw1WebLtdCpw/JpLNVOP8Ycdz+UWapsPwstTHmN0lJjwXrM0v5cYTXymlCeXZMVNm7SMMn627GQFKS+6fZc5ZUf+6x4O5Pp3sgPs+wWFHwLUx37osEz0QEcd9FTeDQ3qXvU+ucNw0cfZKYYBJNbQl2Tg0B/T6z9H6iPv8ghts8xxe7hXJvLm72K4cpU6XhJo5w== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=HtQ88B/CYW7IbFTwDb4CCHs7CgcGwwqB2yynZOsd8h8=; b=b2idTYaqDbg307diyQLfcHmTpGricWWLfOQRnfWJY6JsQXxcl+t5bqOFMYLfwacpyjL3cWlNIxIkMwZqOk7nPgORuCTXyCPDW/Cm4CZZdrSr4Ya8Do/TTTM+It7hyqhRZ4r0zMuVQe5PHYIvOcZWUUrMORCwcesS6Eb7KelnUA2ajGj3bbs1SQ+4ABP2zqYrxnwLFsddQ/EoxkRsHQQLknt9zTk31JiVCFOPbUFjsBpyhEKA7BJbrBiz+Atbl88qORrGkHrfvJMmBhsfS4p8x3NefKcrKJEqRwH8Fb7zhXT0eSwGlfgsOR574DWhxei89RoXEYAqhe1zk8TRrd2R4g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HtQ88B/CYW7IbFTwDb4CCHs7CgcGwwqB2yynZOsd8h8=; b=FPOjXK5TbNouiGDLIQ881t51+pcSOeffWrCg7EtJzQanPLJuviny7vQVMsrIvfmoePRz7qM8S6RK2v29zBHXNjol/+/U0+LXFS2gCyERNVU20L3w9cZHRWt8Ae8vEJUEgwoH7tTcEL+PkzsTx9DcMcGLoD/m7TQYHU37tO52/3E= Received: from BN9PR03CA0472.namprd03.prod.outlook.com (2603:10b6:408:139::27) by SA1PR12MB7441.namprd12.prod.outlook.com (2603:10b6:806:2b3::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.22; Fri, 27 Jan 2023 17:04:38 +0000 Received: from BN8NAM11FT016.eop-nam11.prod.protection.outlook.com (2603:10b6:408:139:cafe::90) by BN9PR03CA0472.outlook.office365.com (2603:10b6:408:139::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.25 via Frontend Transport; Fri, 27 Jan 2023 17:04:38 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT016.mail.protection.outlook.com (10.13.176.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6043.23 via Frontend Transport; Fri, 27 Jan 2023 17:04:37 +0000 Received: from yaz-ethanolx.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 27 Jan 2023 11:04:37 -0600 From: Yazen Ghannam To: , CC: , , , Yazen Ghannam Subject: [PATCH v2 19/22] EDAC/amd64: Split determine_edac_cap() into dct/umc functions Date: Fri, 27 Jan 2023 17:04:16 +0000 Message-ID: <20230127170419.1824692-20-yazen.ghannam@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230127170419.1824692-1-yazen.ghannam@amd.com> References: <20230127170419.1824692-1-yazen.ghannam@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT016:EE_|SA1PR12MB7441:EE_ X-MS-Office365-Filtering-Correlation-Id: d5ceb92f-de60-439b-7b10-08db008892b8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7LdaOE2oInnS6X7HnjrSywvb7GK+fGJKIZzy5whDFXsMnZmM0WOwvoiC1yAgrbWbrlIVYoiU2BixSOIBeuUtSxo2MAqtmWnLL2Wo14LRcjJJpcbYN78YsJsCezyFJtKREFm7HMOOP9wo9m/1zIncxZVSL5yg2wcnfkmkqJyAvumJBQzZ/Jvb29ZaqrR6j7ruaIL8MmPrMmcGAMASWNk/24+pNauR/95CDZIYgf/oXcNFLGp9D8V2I2jesKkzwSapSjmdutMdxsrzQGmzwX/owO+KLqheNwx1qRELr11uF2faV1g3c0JQlY8xdl2xC841uKlZJin37YNB7E8Th7QZ6bg83nJacDFKGDAXsBu6JYY/eDGvej2/NcOBJ+rim7tY1k7VbhTTTRL970kKMYBpYxIrI3ofhyd08tbodUHv6ysum8geJ6d1lqr2eVpsVWWqhF5qaShB8tiGOryf1pxWm448TPW2mDyTWSWbFbQFBsN9ljExCnCZaL3wtpgb+c8kBifiSFiMJQByR4pkmb0PcWfWWbk/pi6AIj0V0obPBi926D8hjAABM5upUIMWO37IxhNjZMBxI/+62AAtdHX+b6GDwLu3uXVIfTtx2xIyzRVYuHqyDltV4zIkcBnepgTAEWGiHdT+2ozJRIxYg/40gh8H1uNE8xWznPK0lAfoUaITTVvs/wM4I3KgDC+TS+jYOsktAPgGJuv9y0/3ewKcKWbWhfO57E2JBLHVhxxMjjXQCeSq5+AezWjYn29eXqUFfb2HN4TiiQuEnAVxTptIAA== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230025)(4636009)(376002)(39860400002)(136003)(346002)(396003)(451199018)(36840700001)(40470700004)(46966006)(40460700003)(36756003)(7696005)(8676002)(1076003)(86362001)(6666004)(54906003)(316002)(110136005)(478600001)(5660300002)(44832011)(2906002)(4326008)(966005)(70206006)(82740400003)(70586007)(41300700001)(36860700001)(40480700001)(356005)(81166007)(186003)(82310400005)(2616005)(336012)(426003)(16526019)(26005)(8936002)(47076005)(83380400001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2023 17:04:37.9704 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d5ceb92f-de60-439b-7b10-08db008892b8 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT016.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7441 Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org From: Muralidhara M K ...and call them from their respective setup_mci_misc_attrs() paths. No functional change is intended. Signed-off-by: Muralidhara M K Co-developed-by: Naveen Krishna Chatradhi Signed-off-by: Naveen Krishna Chatradhi [Rebased/reworked patch and reworded commit message] Co-developed-by: Yazen Ghannam Signed-off-by: Yazen Ghannam --- Link: https://lore.kernel.org/r/20220509145534.44912-13-yazen.ghannam@amd.com v1->v2: * Call function directly instead of using pointers. drivers/edac/amd64_edac.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 1062cb56a462..f1c613107a22 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -1256,13 +1256,25 @@ static int get_channel_from_ecc_syndrome(struct mem_ctl_info *, u16); * Determine if the DIMMs have ECC enabled. ECC is enabled ONLY if all the DIMMs * are ECC capable. */ -static unsigned long determine_edac_cap(struct amd64_pvt *pvt) +static unsigned long dct_determine_edac_cap(struct amd64_pvt *pvt) { unsigned long edac_cap = EDAC_FLAG_NONE; u8 bit; - if (pvt->umc) { - u8 i, umc_en_mask = 0, dimm_ecc_en_mask = 0; + bit = (pvt->fam > 0xf || pvt->ext_model >= K8_REV_F) + ? 19 + : 17; + + if (pvt->dclr0 & BIT(bit)) + edac_cap = EDAC_FLAG_SECDED; + + return edac_cap; +} + +static unsigned long umc_determine_edac_cap(struct amd64_pvt *pvt) +{ + u8 i, umc_en_mask = 0, dimm_ecc_en_mask = 0; + unsigned long edac_cap = EDAC_FLAG_NONE; for_each_umc(i) { if (!(pvt->umc[i].sdp_ctrl & UMC_SDP_INIT)) @@ -1277,14 +1289,6 @@ static unsigned long determine_edac_cap(struct amd64_pvt *pvt) if (umc_en_mask == dimm_ecc_en_mask) edac_cap = EDAC_FLAG_SECDED; - } else { - bit = (pvt->fam > 0xf || pvt->ext_model >= K8_REV_F) - ? 19 - : 17; - - if (pvt->dclr0 & BIT(bit)) - edac_cap = EDAC_FLAG_SECDED; - } return edac_cap; } @@ -3629,7 +3633,7 @@ static void dct_setup_mci_misc_attrs(struct mem_ctl_info *mci) if (pvt->nbcap & NBCAP_CHIPKILL) mci->edac_ctl_cap |= EDAC_FLAG_S4ECD4ED; - mci->edac_cap = determine_edac_cap(pvt); + mci->edac_cap = dct_determine_edac_cap(pvt); mci->mod_name = EDAC_MOD_STR; mci->ctl_name = pvt->ctl_name; mci->dev_name = pci_name(pvt->F3); @@ -3649,7 +3653,7 @@ static void umc_setup_mci_misc_attrs(struct mem_ctl_info *mci) umc_determine_edac_ctl_cap(mci, pvt); - mci->edac_cap = determine_edac_cap(pvt); + mci->edac_cap = umc_determine_edac_cap(pvt); mci->mod_name = EDAC_MOD_STR; mci->ctl_name = pvt->ctl_name; mci->dev_name = pci_name(pvt->F3); From patchwork Fri Jan 27 17:04:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 13119079 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0BE51C54EAA for ; Fri, 27 Jan 2023 17:08:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235163AbjA0RI0 (ORCPT ); Fri, 27 Jan 2023 12:08:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235059AbjA0RIK (ORCPT ); Fri, 27 Jan 2023 12:08:10 -0500 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD2048A56B; Fri, 27 Jan 2023 09:07:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GWo1EYkOfKTmVap3is1i/9AsuEW+dK3lOIA1T75Bf4TrY8so8SmO1yxHs4wYhA6lZSyRQCGJcHiScEQa137vjTdQRACaGJbdnmeQbc2O4knHLlzTOwq5oFHQOXLbKAOzCgGh+vpmq49yt/bin1WFMerrpmiZJS3BEEPJ9c61iDRG+qTOBuZlZ+Q/IqjnTGqTEwzX8tGlKFAopVXEgLO6+stn2vx0B0PGlWgigk+S9NXWp5JX9/twyW5mD9ADmJWOVfcClSyEK+waroc9GJl3QfPBBR2HiX3D5KIPFU2ruAI6g96V1Liqg19WTASy7FVBerQzjcZn8VS7GTkIBo08wQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=LJcRiDJO6FOk9wacaTHCS1n1XjUQ5/6Bsb1cxdMhFcc=; b=ZJ/6lSGy3UZZ5H/INQRC08+ugL00bS0LeazSSUfqwrH/upfrcq0A5P0dfFSi2uARrP2g0QdG9THLHVwuiWArgmlCL47G1BtuSXL3UaUTaTVoLQAAGnJXyX5L4vq6ERyTGRjskgKpiqVEzGMQxqrDrQqDeTBLyTI64y+Cc/VvgBk9Te/S3rPZaNnmb/3lyV1wn0VVSX5nXClo3UBzQUL2PAS2i4eVwWrXR+uN0mv/5hiXL4yca6Tv69V1CB17DF0qDCT6XNOALRZJ/XRQd+Li4eEF0xrHFXTtEorLyJ9zbMGB5Jck2dQErT+thJ06zFNlVFZ2CzvspAcc8uE3D+mYyg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LJcRiDJO6FOk9wacaTHCS1n1XjUQ5/6Bsb1cxdMhFcc=; b=2NlFMv5kUX9pYWGA7ubZKQozYXRvYfjmQ53xtk9okHi3tdVIgjJlcSQd9MjHRgFkpMlfQZvAqI0+9hyOp5fjibJ4OvUIsL9hwmgraWhe3ZX8MBvIaViUVqUeM6tOV2u5hOsc4vOadm2gT1RWJ0/MLLWo92vFVtKYsx0MV7kmEtg= Received: from BN8PR04CA0043.namprd04.prod.outlook.com (2603:10b6:408:d4::17) by DS0PR12MB7701.namprd12.prod.outlook.com (2603:10b6:8:130::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.25; Fri, 27 Jan 2023 17:04:38 +0000 Received: from BN8NAM11FT089.eop-nam11.prod.protection.outlook.com (2603:10b6:408:d4:cafe::1f) by BN8PR04CA0043.outlook.office365.com (2603:10b6:408:d4::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.25 via Frontend Transport; Fri, 27 Jan 2023 17:04:38 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT089.mail.protection.outlook.com (10.13.176.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6023.16 via Frontend Transport; Fri, 27 Jan 2023 17:04:38 +0000 Received: from yaz-ethanolx.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 27 Jan 2023 11:04:37 -0600 From: Yazen Ghannam To: , CC: , , , Yazen Ghannam Subject: [PATCH v2 20/22] EDAC/amd64: Split init_csrows() into dct/umc functions Date: Fri, 27 Jan 2023 17:04:17 +0000 Message-ID: <20230127170419.1824692-21-yazen.ghannam@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230127170419.1824692-1-yazen.ghannam@amd.com> References: <20230127170419.1824692-1-yazen.ghannam@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT089:EE_|DS0PR12MB7701:EE_ X-MS-Office365-Filtering-Correlation-Id: 679ea1c0-acea-41b3-aece-08db008892f3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: c5gp5dBSwMBMg/NeDDngb6QlY4cEUqZAsPg8VAjpSbQaH9Lv6Yy29s+bVa68n1WN+Wxc8+Sgl2H2fQp+XXJ2BJy6JL1rabvOnb4DCwrtkeMXDuV6gsGxHHpOCFIRFxpHBijaKEWUxfHINDvfdzgZ1aIQR0yaSRw5YxlJmrk6n518mSbcxKwiTtNxLxMZUMx6Yfec6HXmFwVPR3faRBkHVOEIz24H3dyi7SjJRwtwdkTFEmnX+hkrdTNWxtsxlUrXpbs6Kvdm+/a/28Yoi6WfB5d5jmDk92KP5jhIFlf1u4QLgVd0zYx6kJ4uHJHu+2XUAYky0Ea+u6SBXEAMWBjrtRkbmlB79ymclFWpLwZD9xCLvt1V/ix+EiuGMnHRaxe1GHtuUpaCq68j4qva16bwzdqBomSUAszEtgpo1/WJ8zN95eB1dM8GN6elbAk7mchFkvqcTg1RqVWpLlLZnHi3ruD+JCwI7MjwDl+QwtX5Jn55N5cp7cV88y2hv3hi+IZDfywR4JcrtXVPtasNygC2dHXnQgGDVRrhwUaJpUj2ITDvOOzdCFVDMIGQvv46ClLYWgATWqLnpTwaPFM3mnfYwpgLb8Bk6qd2MHlQjgJx39GvwAy7goRimhHs7vOSur7dGrZCRGLqBvMjL+ueVR7i6nRcl6C2Bk63T8j0Ni2XAc3D4mr1RZFrAZs4n2L8B+2WNajnp9Vk3xM4e7seDdrsf3D+cHfDIh94e01Ce6KedUKXBplbgA3p61YegHmO9CITUWE4dDgEmzIBC2GbUyPrtA== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230025)(4636009)(376002)(39860400002)(346002)(136003)(396003)(451199018)(46966006)(36840700001)(40470700004)(336012)(70586007)(70206006)(47076005)(5660300002)(4326008)(6666004)(40480700001)(7696005)(44832011)(316002)(8676002)(86362001)(83380400001)(426003)(40460700003)(36756003)(26005)(82310400005)(356005)(1076003)(966005)(81166007)(186003)(16526019)(82740400003)(2906002)(36860700001)(41300700001)(478600001)(110136005)(54906003)(8936002)(2616005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2023 17:04:38.3584 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 679ea1c0-acea-41b3-aece-08db008892f3 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT089.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7701 Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org From: Muralidhara M K ...and call them from their respective setup_mci_misc_attrs() paths. Also, drop the check for an "empty" device, i.e. one without memory. This is redundant and already done in instance_has_memory() earlier in the init path. No functional change is intended. Signed-off-by: Muralidhara M K Co-developed-by: Naveen Krishna Chatradhi Signed-off-by: Naveen Krishna Chatradhi [Rebased/reworked patch and reworded commit message] Co-developed-by: Yazen Ghannam Signed-off-by: Yazen Ghannam --- Link: https://lore.kernel.org/r/20220509145534.44912-16-yazen.ghannam@amd.com v1->v2: * Call function directly instead of using pointers. * Clean up redundant code. drivers/edac/amd64_edac.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index f1c613107a22..ddf2178dabff 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -3250,13 +3250,12 @@ static u32 umc_get_csrow_nr_pages(struct amd64_pvt *pvt, u8 dct, int csrow_nr_or return nr_pages; } -static int init_csrows_df(struct mem_ctl_info *mci) +static void umc_init_csrows(struct mem_ctl_info *mci) { struct amd64_pvt *pvt = mci->pvt_info; enum edac_type edac_mode = EDAC_NONE; enum dev_type dev_type = DEV_UNKNOWN; struct dimm_info *dimm; - int empty = 1; u8 umc, cs; if (mci->edac_ctl_cap & EDAC_FLAG_S16ECD16ED) { @@ -3277,7 +3276,6 @@ static int init_csrows_df(struct mem_ctl_info *mci) if (!csrow_enabled(cs, umc, pvt)) continue; - empty = 0; dimm = mci->csrows[cs]->channels[umc]->dimm; edac_dbg(1, "MC node: %d, csrow: %d\n", @@ -3290,27 +3288,22 @@ static int init_csrows_df(struct mem_ctl_info *mci) dimm->grain = 64; } } - - return empty; } /* * Initialize the array of csrow attribute instances, based on the values * from pci config hardware registers. */ -static int init_csrows(struct mem_ctl_info *mci) +static void dct_init_csrows(struct mem_ctl_info *mci) { struct amd64_pvt *pvt = mci->pvt_info; enum edac_type edac_mode = EDAC_NONE; struct csrow_info *csrow; struct dimm_info *dimm; - int i, j, empty = 1; int nr_pages = 0; + int i, j; u32 val; - if (pvt->umc) - return init_csrows_df(mci); - amd64_read_pci_cfg(pvt->F3, NBCFG, &val); pvt->nbcfg = val; @@ -3333,7 +3326,6 @@ static int init_csrows(struct mem_ctl_info *mci) continue; csrow = mci->csrows[i]; - empty = 0; edac_dbg(1, "MC node: %d, csrow: %d\n", pvt->mc_node_id, i); @@ -3367,8 +3359,6 @@ static int init_csrows(struct mem_ctl_info *mci) dimm->grain = 64; } } - - return empty; } /* get all cores on this DCT */ @@ -3642,6 +3632,8 @@ static void dct_setup_mci_misc_attrs(struct mem_ctl_info *mci) /* memory scrubber interface */ mci->set_sdram_scrub_rate = set_scrub_rate; mci->get_sdram_scrub_rate = get_scrub_rate; + + dct_init_csrows(mci); } static void umc_setup_mci_misc_attrs(struct mem_ctl_info *mci) @@ -3658,6 +3650,8 @@ static void umc_setup_mci_misc_attrs(struct mem_ctl_info *mci) mci->ctl_name = pvt->ctl_name; mci->dev_name = pci_name(pvt->F3); mci->ctl_page_to_phys = NULL; + + umc_init_csrows(mci); } static int dct_hw_info_get(struct amd64_pvt *pvt) @@ -3873,9 +3867,6 @@ static int init_one_instance(struct amd64_pvt *pvt) pvt->ops->setup_mci_misc_attrs(mci); - if (init_csrows(mci)) - mci->edac_cap = EDAC_FLAG_NONE; - ret = -ENODEV; if (edac_mc_add_mc_with_groups(mci, amd64_edac_attr_groups)) { edac_dbg(1, "failed edac_mc_add_mc()\n"); From patchwork Fri Jan 27 17:04:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 13119067 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80C49C38142 for ; Fri, 27 Jan 2023 17:06:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235018AbjA0RGE (ORCPT ); Fri, 27 Jan 2023 12:06:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234944AbjA0RFn (ORCPT ); Fri, 27 Jan 2023 12:05:43 -0500 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on20606.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe5a::606]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FDCA77502; Fri, 27 Jan 2023 09:05:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AXNEkzrEMMoaOPPCDgI5mTPzxfR+vAbGPpL9LN/HkgQvOHGd+5x3A8pNL2GXHd8BPijholVCecGgshejc4r2IszA/n29SCbO4AVWMu9f9dqncpzwK3xsUoWkfI1XBg1Y8xyBw96WPzM1EMBk39NFFPLsFCsYwKXb8IF5a+jLIBLfGJxRFHfgy1xPUz8/O0wCGCJPhzyfX3iO9oPFArryE2XqKbbmGz14Ggyh5mTM+9ilHtcN5PVz0vvMKowkuYBfWFYRmoE29wW9pmCwDGtJ5/hZU5RY+vWSWXmgw33gBIsfCFrJkkRC1dBOkFzPCT2/JS+wYjakZNYgqGuL0JMjwA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Q161Gkx4OKsPgU/TegAPI0ZEFw1VE8VzRgmq/AUf6n8=; b=OZQmdkzOM+tx4UIexRaaEZiURVqtHmNZnNcX6EcMS5Z0VM6mruCD1Dl+L5v1gM8Pgca4pO+FKClS65KsPrjKkQPuM0DGP7hf8mxryu7lPJs/THbJ3T2uwq9rskUOmwpPDjcBXA49b2AuO343OYrWVBoWFPif246Y6ggxcRg8roH2c2nTrz0XvwLn/YfYIa16XxbOqEPpnKnqRiV6OAfvTlKNOdVxqakWA/2L+J+n7vAs8ocgBDKjELR10viqlNVGge8FEraNLrgcQt/kJwM2gTN5Ai0EPkhmz/xbB1Em4Y1u2zrtKtRmYs15ZlOJulHqV53KIDe+jS7MwE5r41Gscw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Q161Gkx4OKsPgU/TegAPI0ZEFw1VE8VzRgmq/AUf6n8=; b=wrZC0EXrujG5s0bsPv7sI2vBwDwpB8FSCK1MWmy5+OXC+AxM3cpRJSlKC29r3MoQhM/jMYfE/Q5ZfP/5f3909HbIIZW4JiiL8ioGgxept7Rg/oViNni9XpQXP9GB+TkXA9TYQ41s5qKV/bzm4w1WUGlTta7Uh5DSTD3FKJnL8s0= Received: from BN8PR04CA0058.namprd04.prod.outlook.com (2603:10b6:408:d4::32) by PH7PR12MB6587.namprd12.prod.outlook.com (2603:10b6:510:211::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.25; Fri, 27 Jan 2023 17:04:39 +0000 Received: from BN8NAM11FT089.eop-nam11.prod.protection.outlook.com (2603:10b6:408:d4:cafe::c0) by BN8PR04CA0058.outlook.office365.com (2603:10b6:408:d4::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.25 via Frontend Transport; Fri, 27 Jan 2023 17:04:38 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT089.mail.protection.outlook.com (10.13.176.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6023.16 via Frontend Transport; Fri, 27 Jan 2023 17:04:38 +0000 Received: from yaz-ethanolx.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 27 Jan 2023 11:04:38 -0600 From: Yazen Ghannam To: , CC: , , , Yazen Ghannam Subject: [PATCH v2 21/22] EDAC/amd64: Split dump_misc_regs() into dct/umc functions Date: Fri, 27 Jan 2023 17:04:18 +0000 Message-ID: <20230127170419.1824692-22-yazen.ghannam@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230127170419.1824692-1-yazen.ghannam@amd.com> References: <20230127170419.1824692-1-yazen.ghannam@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT089:EE_|PH7PR12MB6587:EE_ X-MS-Office365-Filtering-Correlation-Id: 85bc5f61-0004-4e79-33ca-08db0088933b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: au85aBI1tlkf/aZA0y+7ldcJT+2t3I76/OBy6Z+7FSRqS90vvAf68mNk+Wk+1A2ZDcxPOkND15X66nFePbJsZFNI/D6JvCPgpg/MXemJQtXh/hyYslO/k0ZwSs/zpboMi2HJp4M9qtgvjspejny/qkZ9XtSVernjszOf3YF1Kp1bJUY1aLBQek8UQ+nR0mlVjbDikzvgi1Bo1tQ896n8js9/mpRQhhkAsgDp9JogXAMjmE+8j6d46lvZ40vqHBO3iQPGZYLBMahueRhWoSvTdr/t3I2/ahyzfPX25P4lN0PjoH4GxapOtTvODhM2O1DsClEnz3sG15cX/6ObmaHeDv6WXIovtEhLh7tyep9NVGwPsEZKP2M9gcjEYv4fuGPBdOcx4oDRMMjuhgyaAHP11eyO2y4nQ4UxpAeTmU4mIfD2kktnAeHMwPz3NXNQlt/8kL+cg6DMu2UUUIfZO9O1szIcsJVigXUAbUGATTSxotpwZsAKsoEpJXz1K/+D3bbDDhFnm5r1SzLleVDWMjptmtHek7NwJtEV5K/9bicbFQzgdE7KZCCTg5B4MqSAcs/6oIZ5Zmlc/MLACrlKDfODTcBFqst91MqqL+qfohsK8LsfizdCoOTKPP9qtu3TAubefJqCYVupSeEpr/sUlIT6At+eBGuvgDoW1bJGu6cJRLU0hGlYF1MslELBmjVJV1P5lvqG6n6ieynsJgFCqAncOaUVAltvosxNnr+U+kzKYkEGiGQAuunLvBC4cIblNfG0f5CrY09zkLBeioeoSrJksw== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230025)(4636009)(376002)(39860400002)(136003)(346002)(396003)(451199018)(36840700001)(46966006)(40470700004)(70586007)(4326008)(8676002)(2616005)(36860700001)(41300700001)(8936002)(54906003)(316002)(110136005)(36756003)(82310400005)(1076003)(356005)(16526019)(26005)(186003)(81166007)(40460700003)(5660300002)(70206006)(2906002)(426003)(83380400001)(82740400003)(336012)(47076005)(966005)(6666004)(7696005)(40480700001)(44832011)(86362001)(478600001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2023 17:04:38.8271 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 85bc5f61-0004-4e79-33ca-08db0088933b X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT089.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6587 Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org From: Muralidhara M K ...and add a function pointer to pvt->ops. No functional change is intended. Signed-off-by: Muralidhara M K Co-developed-by: Naveen Krishna Chatradhi Signed-off-by: Naveen Krishna Chatradhi [Rebased/reworked patch and reworded commit message] Co-developed-by: Yazen Ghannam Signed-off-by: Yazen Ghannam --- Link: https://lore.kernel.org/r/20220509145534.44912-17-yazen.ghannam@amd.com v1->v2: * Call function directly instead of using pointers. drivers/edac/amd64_edac.c | 19 ++++++------------- drivers/edac/amd64_edac.h | 1 + 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index ddf2178dabff..6b450544a892 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -1525,7 +1525,7 @@ static void umc_debug_display_dimm_sizes(struct amd64_pvt *pvt, u8 ctrl) } } -static void __dump_misc_regs_df(struct amd64_pvt *pvt) +static void umc_dump_misc_regs(struct amd64_pvt *pvt) { struct amd64_umc *umc; u32 i, tmp, umc_base; @@ -1568,8 +1568,7 @@ static void __dump_misc_regs_df(struct amd64_pvt *pvt) } } -/* Display and decode various NB registers for debug purposes. */ -static void __dump_misc_regs(struct amd64_pvt *pvt) +static void dct_dump_misc_regs(struct amd64_pvt *pvt) { edac_dbg(1, "F3xE8 (NB Cap): 0x%08x\n", pvt->nbcap); @@ -1606,15 +1605,6 @@ static void __dump_misc_regs(struct amd64_pvt *pvt) amd64_info("using x%u syndromes.\n", pvt->ecc_sym_sz); } -/* Display and decode various NB registers for debug purposes. */ -static void dump_misc_regs(struct amd64_pvt *pvt) -{ - if (pvt->umc) - __dump_misc_regs_df(pvt); - else - __dump_misc_regs(pvt); -} - /* * See BKDG, F2x[1,0][5C:40], F2[1,0][6C:60] */ @@ -3694,6 +3684,7 @@ static struct low_ops umc_ops = { .hw_info_get = umc_hw_info_get, .ecc_enabled = umc_ecc_enabled, .setup_mci_misc_attrs = umc_setup_mci_misc_attrs, + .dump_misc_regs = umc_dump_misc_regs, }; /* Use Family 16h versions for defaults and adjust as needed below. */ @@ -3703,6 +3694,7 @@ static struct low_ops dct_ops = { .hw_info_get = dct_hw_info_get, .ecc_enabled = dct_ecc_enabled, .setup_mci_misc_attrs = dct_setup_mci_misc_attrs, + .dump_misc_regs = dct_dump_misc_regs, }; static int per_family_init(struct amd64_pvt *pvt) @@ -3953,7 +3945,8 @@ static int probe_one_instance(unsigned int nid) amd64_info("%s detected (node %d).\n", pvt->ctl_name, pvt->mc_node_id); - dump_misc_regs(pvt); + /* Display and decode various registers for debug purposes. */ + pvt->ops->dump_misc_regs(pvt); return ret; diff --git a/drivers/edac/amd64_edac.h b/drivers/edac/amd64_edac.h index 1fb39d7981a2..1c64fd4a14b1 100644 --- a/drivers/edac/amd64_edac.h +++ b/drivers/edac/amd64_edac.h @@ -469,6 +469,7 @@ struct low_ops { int (*hw_info_get)(struct amd64_pvt *pvt); bool (*ecc_enabled)(struct amd64_pvt *pvt); void (*setup_mci_misc_attrs)(struct mem_ctl_info *mci); + void (*dump_misc_regs)(struct amd64_pvt *pvt); }; int __amd64_read_pci_cfg_dword(struct pci_dev *pdev, int offset, From patchwork Fri Jan 27 17:04:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 13119071 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72ADDC636BD for ; Fri, 27 Jan 2023 17:06:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234968AbjA0RGJ (ORCPT ); Fri, 27 Jan 2023 12:06:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234966AbjA0RFs (ORCPT ); Fri, 27 Jan 2023 12:05:48 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2061a.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e88::61a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FC841C5B0; Fri, 27 Jan 2023 09:05:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QJXRFUYd4vRIFfDh7a+UFVid4teuYZ/Zyool6JTc6CX1wN5y8fZHBHmdB320fdvuaCuyBk4Epp+tgSjMF1KLCQxvDJjV+h2rY0JlQsacDsoJrWNzMbhEZ8cshB6a+NOhLq5LZ0AXI+YjRVmK4K5HzDo4SCof/DdA5xKWZCpIJPaGRVsyfopcjBcBUepKs9Qv9sRQ0FzIfgQOgRb+BV8d9W5YIhXgk7szimn/zVrxkYX9R1SF3UrCk0oFakNuXdoqz1yJwMipZNfZzPIKGhtauTL9zoTgPghqGq1bglR4pdgx0CxSx4MnKNQFhUd1Ok8ONnZ9MWgKh7ZTTMEQFSdN1w== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=vRoAFz9642bohYpHwQJoBh/9I5h0ghxbapmFQ5TGz+Y=; b=Dqk2TwLwfGHmH7hzBiGbLQXneKmE9Q8h1qSLJZdQAk21Tog9k1sVNB3moqUq7ABuCG3nPgN3CylFaz1CBmKly/+4Nccn8DIB+uxRS3pzSPeWhRXVJO3gJuNsSGVfKHD2Wh24JU5KxC6DlhEAif1soqe3MoFwCHzgmDKHquks0HI9sZ1KzqqlpLhxmeejhXhnZ6k2dY6bFUNdcqqRQL8zerl6ZKIZarOO9Pu8uycw8ai8O17vENSV6SbYZNLzd5e1FADIOOTK5uu1MkN4iQU1USPqOa83W9MLSfHGBm0utB7cKtunFrfRaGqT7ZFTfEedbROMmeI8eKihjiO6v1xtVw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vRoAFz9642bohYpHwQJoBh/9I5h0ghxbapmFQ5TGz+Y=; b=Qe9FKj+CYG6d/mVi8GNSN7ZwBxezybBIWlb+lPkr0pYASXMp/a0SFhG+r6ctQ5ab87IgsnxyRfufdBpgO8lRv0k8dd0WWf2Jc1mkUXgPNS/dyayFlmj/RugVC9bcjUcKaGK+XMvL06UD1dZS8oRBis2+EH+9z+B2/ClYGUv+2RY= Received: from BN9PR03CA0459.namprd03.prod.outlook.com (2603:10b6:408:139::14) by SJ2PR12MB8157.namprd12.prod.outlook.com (2603:10b6:a03:4fa::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.23; Fri, 27 Jan 2023 17:04:39 +0000 Received: from BN8NAM11FT016.eop-nam11.prod.protection.outlook.com (2603:10b6:408:139:cafe::69) by BN9PR03CA0459.outlook.office365.com (2603:10b6:408:139::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.23 via Frontend Transport; Fri, 27 Jan 2023 17:04:39 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT016.mail.protection.outlook.com (10.13.176.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6043.23 via Frontend Transport; Fri, 27 Jan 2023 17:04:39 +0000 Received: from yaz-ethanolx.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 27 Jan 2023 11:04:38 -0600 From: Yazen Ghannam To: , CC: , , , Yazen Ghannam Subject: [PATCH v2 22/22] EDAC/amd64: Add get_err_info() to pvt->ops Date: Fri, 27 Jan 2023 17:04:19 +0000 Message-ID: <20230127170419.1824692-23-yazen.ghannam@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230127170419.1824692-1-yazen.ghannam@amd.com> References: <20230127170419.1824692-1-yazen.ghannam@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT016:EE_|SJ2PR12MB8157:EE_ X-MS-Office365-Filtering-Correlation-Id: 7dd5d219-7633-4f49-bf3a-08db00889361 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PPPp72A+hQe20wkZipafRebmOshnK+c/jKRfOvyEpezoi+i3YHp0lQ4sJWYnrVrInfxnPfyY2nySl1HcvV8rybdKvli0BBEcg39dBBZmnmQaz6Tt+AVcDPwHprrDjU7ns85dPhfIPuJUaSIDCY2F8LcPgKFBy2ggvPDpvjBT9S2FBMOc0D2GJ2snzoMZaaZokNz1VW8a+bKSdM+FcwLfc1quNLqs7Xdwk+vLEyBokxCoLSOds6pyNnlVrBURvzAgoEkVY8tEx6ObhdKkLFYXrIV0IQ0DrGRuFpSZr72g/JHHu2FHcjrT5X5WrH16gO7f83NaDqfM2+qLHMAfQ1p6JqRQlsgWT4tzPMF0wKUwIYw6w4A6D/7vBCR9inFf4ccZBiqCsww3q2KIq0WecKq7/OOS9+uHbsm3GyKANya6nqxgPb5mU8O48Xc9lj3wKmBuFSIhs/ui/zlDPLN5SHxaLed7+MMqJcahZrPZvLqNLOxpLKAFOHYNVI1UXhDxV5S8sOkOE+71TmnVtixaLrcXlJ+wt/PIZqSvZ155dVavB3omZ/eOgPo3B9D+7fjRMseBjzmPAxizl4L+q+qKkJTPtCUaTUrIXrimAa7MkBJNLggZPGDiO9xYLuG0Xx6ll1wWy3X3j/pRQSxMLlS3ahpCacUj+S24NdR2YmatRXREvt6bw6CeZQQvLWfCvtafMj1UUtvLd6/RJS1Vefja48OovSk01iRFcjQfOzRJs9wbmQsTG7/FZun9uoZQA70yRZD/fr32Cz9KhUOJQA9HjmdxFw== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230025)(4636009)(39860400002)(376002)(396003)(346002)(136003)(451199018)(40470700004)(46966006)(36840700001)(356005)(44832011)(2906002)(5660300002)(81166007)(8936002)(41300700001)(86362001)(6666004)(966005)(478600001)(40460700003)(83380400001)(36756003)(110136005)(36860700001)(54906003)(82740400003)(316002)(47076005)(426003)(336012)(2616005)(7696005)(40480700001)(8676002)(4326008)(70586007)(70206006)(82310400005)(1076003)(26005)(16526019)(186003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2023 17:04:39.0953 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7dd5d219-7633-4f49-bf3a-08db00889361 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT016.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8157 Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org From: Muralidhara M K GPU Nodes will use a different method to determine the chip select and channel of an error. A function pointer should be used rather than introduce another branching condition. Prepare for this by adding get_err_info() to pvt->ops. This function is only called from the modern code path, so a legacy function is not defined. Make sure to call this after MCA_STATUS[SyndV] is checked, since the csrow value is found in MCA_SYND. Signed-off-by: Muralidhara M K Co-developed-by: Naveen Krishna Chatradhi Signed-off-by: Naveen Krishna Chatradhi [Rebased/reworked patch and reworded commit message] Co-developed-by: Yazen Ghannam Signed-off-by: Yazen Ghannam --- Link: https://lore.kernel.org/r/20220509145534.44912-19-yazen.ghannam@amd.com v1->v2: * Drop a redundant line in code comment. drivers/edac/amd64_edac.c | 13 ++++++++----- drivers/edac/amd64_edac.h | 1 + 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 6b450544a892..ee291859cee3 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -2974,10 +2974,14 @@ static inline void decode_bus_error(int node_id, struct mce *m) * Currently, we can derive the channel number by looking at the 6th nibble in * the instance_id. For example, instance_id=0xYXXXXX where Y is the channel * number. + * + * For DRAM ECC errors, the Chip Select number is given in bits [2:0] of + * the MCA_SYND[ErrorInformation] field. */ -static int find_umc_channel(struct mce *m) +static void umc_get_err_info(struct mce *m, struct err_info *err) { - return (m->ipid & GENMASK(31, 0)) >> 20; + err->channel = (m->ipid & GENMASK(31, 0)) >> 20; + err->csrow = m->synd & 0x7; } static void decode_umc_error(int node_id, struct mce *m) @@ -2999,8 +3003,6 @@ static void decode_umc_error(int node_id, struct mce *m) if (m->status & MCI_STATUS_DEFERRED) ecc_type = 3; - err.channel = find_umc_channel(m); - if (!(m->status & MCI_STATUS_SYNDV)) { err.err_code = ERR_SYND; goto log_error; @@ -3015,7 +3017,7 @@ static void decode_umc_error(int node_id, struct mce *m) err.err_code = ERR_CHANNEL; } - err.csrow = m->synd & 0x7; + pvt->ops->get_err_info(m, &err); if (umc_normaddr_to_sysaddr(m->addr, pvt->mc_node_id, err.channel, &sys_addr)) { err.err_code = ERR_NORM_ADDR; @@ -3685,6 +3687,7 @@ static struct low_ops umc_ops = { .ecc_enabled = umc_ecc_enabled, .setup_mci_misc_attrs = umc_setup_mci_misc_attrs, .dump_misc_regs = umc_dump_misc_regs, + .get_err_info = umc_get_err_info, }; /* Use Family 16h versions for defaults and adjust as needed below. */ diff --git a/drivers/edac/amd64_edac.h b/drivers/edac/amd64_edac.h index 1c64fd4a14b1..e84fe0d4120a 100644 --- a/drivers/edac/amd64_edac.h +++ b/drivers/edac/amd64_edac.h @@ -470,6 +470,7 @@ struct low_ops { bool (*ecc_enabled)(struct amd64_pvt *pvt); void (*setup_mci_misc_attrs)(struct mem_ctl_info *mci); void (*dump_misc_regs)(struct amd64_pvt *pvt); + void (*get_err_info)(struct mce *m, struct err_info *err); }; int __amd64_read_pci_cfg_dword(struct pci_dev *pdev, int offset,