From patchwork Mon May 9 14:55:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 12843722 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 42035C433FE for ; Mon, 9 May 2022 14:55:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237860AbiEIO7t (ORCPT ); Mon, 9 May 2022 10:59:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237870AbiEIO7t (ORCPT ); Mon, 9 May 2022 10:59:49 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2064.outbound.protection.outlook.com [40.107.94.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C76781DF675; Mon, 9 May 2022 07:55:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ekq0wtNNriMq51s9Tu0xdpqkc8lv+QG0vqWFR5WfTvAFd+dJqPGh9NoNdw4LUEblBGaQ7YyUi1L1dVMOtjDvL0uEQA9KzHOPMegXd3nB2DfHKfxVJiBGE+4oi6U2Z+nD3QewL2nGg15v7vsyFb+w5dLoswIE4Iyd64w0XZxIf+CQpew26n1dwtJyP74SGZ8tDbLfjLmpggWNZVP7iMC+Tlq27eSoIHMWgosAJcqE/cGeIvlzT8DKlFQ/WPnODIvTvUP9HQPrOm6I3TjXRBaDVw/1rBpoOL6dfQ4DuF+4e3Ecr9XHBk1u6LxbMgIJclE5JeaZ0cgNwIob17fFTuYXAQ== 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=bbGAXCK+O2dJVvdKuux7MSmdl1vdRXcaLqBnjew0oOk=; b=fVV/6QY25oy3VdfSr7c41q/bAhVa0PVsCzs6kuCkJwFG1lPlB92im8RsJ8/Ze2v5c4mvoniGfQF9QqwPoE4ekKrGrLdthPMim8o9QSIs56MzDJAdS3uMv+nuwcYo0ttXc/7foKod86GV+RCbdzBwKvSysO+eTKnUqHD3euECCIw5FGjt/ZGo7HhVBysQsCPCESJlv1U+v3q/uv2A3zD/PJ+2Z3pKuX2VKH6u6NoBu2U78DHIJBxsZSEf1olsZoo8z0BfdYeLkwPNzGDyMcPYOreVEiw0cUDjLY5d0S255LD5eU2JSnNHZW8F8NI9TWjMGRmRG3AhfZJ1cRZ2w6i3Xw== 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=bbGAXCK+O2dJVvdKuux7MSmdl1vdRXcaLqBnjew0oOk=; b=j8t/yS/eWNL4hRHewn1dqRJ4VVcMo8NQyQXXb1sSyqUDUCiHIHVt7X8gkHsF+yQNRXo09UWSaltjQlCVYHr85mu75snrgjiZZp5z9CBRMPZ/qdPzHDDZzNStg9pJyS7p6DQwX5+E/kimiieKG8/TFBPv5WA/JlAacykAA0HLXdA= Received: from MW4PR03CA0326.namprd03.prod.outlook.com (2603:10b6:303:dd::31) by DM6PR12MB4761.namprd12.prod.outlook.com (2603:10b6:5:75::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.23; Mon, 9 May 2022 14:55:50 +0000 Received: from CO1NAM11FT064.eop-nam11.prod.protection.outlook.com (2603:10b6:303:dd:cafe::c2) by MW4PR03CA0326.outlook.office365.com (2603:10b6:303:dd::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.22 via Frontend Transport; Mon, 9 May 2022 14:55:50 +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; Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT064.mail.protection.outlook.com (10.13.175.77) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5227.15 via Frontend Transport; Mon, 9 May 2022 14:55:49 +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.24; Mon, 9 May 2022 09:55:46 -0500 From: Yazen Ghannam To: , CC: , , , , Yazen Ghannam Subject: [PATCH 01/18] EDAC/amd64: Don't set up EDAC PCI control on Family 17h+ Date: Mon, 9 May 2022 14:55:17 +0000 Message-ID: <20220509145534.44912-2-yazen.ghannam@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509145534.44912-1-yazen.ghannam@amd.com> References: <20220509145534.44912-1-yazen.ghannam@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 13df4b73-d5d2-41f6-e3c3-08da31cc01bc X-MS-TrafficTypeDiagnostic: DM6PR12MB4761:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 29nVO/YQSqBXRmUIgu5T+SESzaoSve4KaOgOvBKwdJbqaZTZZyUryUiH+w31YlezjO39uszsX48Of+VKXznhyL/mH32J10ex1Ng/xO9h84e8EHFd5YwLqRKkhdkqAxH9pUh9mk7ojn1qLA3xXFAeiSINf7+4AnV3bxwmqDboIJ4u2SYBpNVVT++bEVFlnfGjP0WzRA0cVELoQzPm4BGET4k9pXuKlYKL5IUfxPXmn8+UiYTskSYA22TRKoWGBgu1kXpOfgkIFt7fEyJ1mLL2hysjAW/+Et2ao3zRT9tBci4c+SC3zXt/LjnTPVWOopfCs3UsKW9yvXLu2fwAaUAkRSCv9fmwBrlIjh44kyiSPJ6JdxNFH0qMfX41lhtq7rEmv3V9ZTJh/VsskMrLcJvSfXYPfvfFsxvP1piQR0mn1Yolxc/bXVHzAqkXBs2d1dPjMWDHDsqW8kXjc3ZLq3beuspT2P7WxXlcasC+/cT7huZIqopf6oRpCHgynav3I//ej0rvdIkWdWZ778P/GwiqQBawT8dH8dTBakDaeZTiH3GR8GdLesv1MYqtZefnqtXm4QDojgTVDgrw/uyLBaRpAEE4YfLgvtm4NdB1EhmGZLjy2X4TjL/Sk0CyZLNHt8IY5nzv9ly70zVrlUCn2QLAGm3nKZuxr4iWfqKUHiTph96onFlxf4HhxruaBQNH9QAMZ0vQWxX8R0jrKxKTDR4lNg== 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:(13230001)(4636009)(40470700004)(36840700001)(46966006)(83380400001)(186003)(16526019)(36860700001)(2616005)(2906002)(1076003)(110136005)(44832011)(26005)(36756003)(47076005)(82310400005)(426003)(40460700003)(336012)(6666004)(356005)(86362001)(508600001)(5660300002)(8936002)(7696005)(70206006)(70586007)(54906003)(8676002)(4326008)(81166007)(316002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 May 2022 14:55:49.6717 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 13df4b73-d5d2-41f6-e3c3-08da31cc01bc 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: CO1NAM11FT064.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4761 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 --- 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 2f854feeeb23..04fa96592317 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -4367,12 +4367,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 Mon May 9 14:55:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 12843724 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 4A21AC433F5 for ; Mon, 9 May 2022 14:56:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237892AbiEIO7y (ORCPT ); Mon, 9 May 2022 10:59:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237886AbiEIO7w (ORCPT ); Mon, 9 May 2022 10:59:52 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2053.outbound.protection.outlook.com [40.107.237.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 311BA268E83; Mon, 9 May 2022 07:55:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Jq9qBEpgQQLl72KnPsZD897A+C0Dz4+B55DnBGUnteHL/txFLZjwqIiclxZdKBSOWe/y3UgP01oh7p7wx4bQkZU1VJwHnUe5yCmI+DAMjoWF0E51iLk4BoIDJfXnm/7AYw7tFRbCd5spZw7i/leqHRG7UbrtGZd0l4QVCVKmtpqfaIpnmWD+Qxg9B0r4PzClWfzJqVgNgwdYHDuEGTTpJm33edpmmU5kgnNKlhrnHYjtuVHYl0xsW9/kZPoPTr14FFIQHEw/NSXgRdChLB6nHJgllS6CDQY+W00x7mJe6neZZrq0vnrx0hRuD4TQ5W8nRG0fRGgOqITRh8U126yl7g== 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=6wno+7ls8vQ+7dF5/kXS9PGnb4IuwfO/mvL275OgBPQ=; b=bgAIoK7/wcthcaer7DZ0PrAOtAxLlZw/NX9Mbo+YRxX21cxZ68JXhKzZWTn2ADbz9DAvDlPVDOHOPgEDqnabfYJcJk7ZqqE1kxOx9ylhB8dqHCmSdkf/eBxVJWExE4Kg/DmHDL9XlNgBhcj2IOG979YBP6i+FHzjr1nJlo5TbhV0woGLgtRBzv3IMC54U1mz0xYYuhDiY5NFIfqiE+I/loZsbdA9r1DPNSoyXFdNWtkM7o5LpfjTQWHvalxGAhK35Wfo/pmt0I4VXOJaDXOQ1mKin2N2cJsh4jQrTikW0g/diBIswue3feCz1+MaSGlLKctVnYQEOX2wB8aYoALA3Q== 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=6wno+7ls8vQ+7dF5/kXS9PGnb4IuwfO/mvL275OgBPQ=; b=BAKeOVORcOPK0j3vQEYiRdUnIVWXYkMoS2MqbWI4rdTf8zqH5RJ+F0HZ2+l67Hq4hm2QTExZorDbEjWbuuqHSEPnBu6c71ps2IA1ZzN7vYyiiTZKgbECk4qGLdiFx0NEeo8uHgqJM+Kh03MSc1Dadn01OXZnXF08nCS5/5L8UDc= Received: from MW4PR03CA0017.namprd03.prod.outlook.com (2603:10b6:303:8f::22) by PH0PR12MB5497.namprd12.prod.outlook.com (2603:10b6:510:eb::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.22; Mon, 9 May 2022 14:55:54 +0000 Received: from CO1NAM11FT009.eop-nam11.prod.protection.outlook.com (2603:10b6:303:8f:cafe::31) by MW4PR03CA0017.outlook.office365.com (2603:10b6:303:8f::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.21 via Frontend Transport; Mon, 9 May 2022 14:55:53 +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; Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT009.mail.protection.outlook.com (10.13.175.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5227.15 via Frontend Transport; Mon, 9 May 2022 14:55:52 +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.24; Mon, 9 May 2022 09:55:46 -0500 From: Yazen Ghannam To: , CC: , , , , Yazen Ghannam Subject: [PATCH 02/18] EDAC/amd64: Remove scrub rate control for Family 17h and later Date: Mon, 9 May 2022 14:55:18 +0000 Message-ID: <20220509145534.44912-3-yazen.ghannam@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509145534.44912-1-yazen.ghannam@amd.com> References: <20220509145534.44912-1-yazen.ghannam@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d598095f-5a78-41bc-c0bb-08da31cc0349 X-MS-TrafficTypeDiagnostic: PH0PR12MB5497:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lZZH8WUXB2RX+LbHjS9OF/X1WhGFy40YpfqWhx7XuNrE+vx3Dxd7OF0EMoazn3Y6UWxAx4KHBZebKbG6PL2mxVdvfm5Eqeb2YhQ6pnzFt7SRMRnXgq5Uf6Pp4IN9GN2Ig1lefsNKkilWwIDIJC4szr/TT7fZ0+dqzbpYc08Jq/+6A5RMgfkjaJpmXweobPKStPaeCmOzNW970VkaOyQMy2qYp84DDnsyRQ0/rqdk6WKQ6j9v+pUqY01dkBMgF/E/7vjt3G5+4Z1J/b18nosRgu9JpjFyt5WulrccLUKsZblhCzSJ+khicMOZ+frfcHQz03iKk/+7W/G6k7rnfoNSawN3VXW6uDHMMwkOpUxtnWn8EavRrw1QbfhC5R/Iy1drLwOHgmDknLAu9Rnv7UQyAx1rq7ExJjX8khHom0hvSfgYStOheAU59tEPFnlBy8pbnnmSHmFsaiakfTYWgJw2L+Q/XeNyeTmJqMOgSIfFO9m47xsR+sAuu12buFH04vS4UdqnmUXV7fy26kbgaVXH8b4oLoE1OCe8GPpSH1aTI1pOdWz4VZJRg/LxKzVxC3+D057xbOoDcOvxgrosTNOEDpP0Wm3FngltUB25M2V6pzj9Kb/PR0G3RM6VwwnuSKA/2L2FFbkEY0GkvvRiYYGmtBddEyVYC/S3AgD2CShxMLlIwubIA6fXFa+iYUrCuX10UUXVbfYrRMkkfTYmtutyvg== 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:(13230001)(4636009)(46966006)(36840700001)(40470700004)(36756003)(82310400005)(1076003)(2906002)(36860700001)(8936002)(44832011)(5660300002)(8676002)(70206006)(4326008)(70586007)(54906003)(16526019)(86362001)(186003)(40460700003)(110136005)(83380400001)(2616005)(26005)(336012)(7696005)(316002)(81166007)(47076005)(426003)(6666004)(356005)(508600001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 May 2022 14:55:52.2569 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d598095f-5a78-41bc-c0bb-08da31cc0349 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: CO1NAM11FT009.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB5497 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. Also, return an -EPERM code for these systems. This matches the description in Documentation/ABI for this file. Also, this matches the behavior that the OS is not permitted to modify the scrub registers. Signed-off-by: Yazen Ghannam --- drivers/edac/amd64_edac.c | 31 +++++-------------------------- drivers/edac/amd64_edac.h | 2 -- 2 files changed, 5 insertions(+), 28 deletions(-) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 04fa96592317..3ec7eb4ceb4e 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); @@ -251,6 +234,9 @@ static int set_scrub_rate(struct mem_ctl_info *mci, u32 bw) struct amd64_pvt *pvt = mci->pvt_info; u32 min_scrubrate = 0x5; + if (pvt->umc) + return -EPERM; + if (pvt->fam == 0xf) min_scrubrate = 0x0; @@ -272,14 +258,7 @@ static int get_scrub_rate(struct mem_ctl_info *mci) 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; - } + return -EPERM; } else if (pvt->fam == 0x15) { /* Erratum #505 */ if (pvt->model < 0x10) 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 Mon May 9 14:55:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 12843723 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 93BEEC4332F for ; Mon, 9 May 2022 14:55:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237877AbiEIO7u (ORCPT ); Mon, 9 May 2022 10:59:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237871AbiEIO7t (ORCPT ); Mon, 9 May 2022 10:59:49 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2051.outbound.protection.outlook.com [40.107.93.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC55A195E88; Mon, 9 May 2022 07:55:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e3R4FZ2B97bjBvKtcGbDN0Icr/AMiaywDDDNCaUYMnaW2LO6svVeNDDvktZDVmKVhPK5MTGVVyABYQKRCxeNPzw0wc/wfWyib0tISdqnXUd6JmP8dstaPJnYJvit7G3BNjAQkp1eDaGKF63EHFBHFaX+WKPA7c6zI6b1cQbypY36t3slCmu8msWjxg2aYbJAK4v8DYO/Wq1yJcB0bWzFPdXiX0+oFTCByGZ8sLHWpBclBS+degrULqoboLA3HMOvbC3Pv3NqaVYX7mBP0ibdGK7IY9FskKgWZaOogHA7+bwQF1v2nmg3iMrqvXr5e4PN/EvOqdEr2Qk0pp0Z0ATd0A== 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=aTxfBI943Xz904QZI71rENW0fo91agoh3SfdF/GnC0Q=; b=KUEf3JdA9Gwss6njvZjOEl4ED4E8w/R1T4ajOUc2wj8vBLH494P2npxT/It1UVXXtMLAGz3pLAftaUZ7GyHMXX9TlnuBSAQq5fbSgZ+UCypxtRXMLTYd+NpxE/tFwKnUWfBNCGInji77exO2xLiwLLIYiSeB8xDphSBZNqDTCfLDK9DLECAtY3tvFtyfo2WfUyQSojBLWs6ZZqLG0vwXOiwR6RvEHEkoe+KDqYWw3mN8CNiKIkCn68r2TwygHiCBF+U/i2yOFgLSBhKo/tHFOJvxR2RHqgZcO+Vj6eeTvaYS4LppTNfXtpIqDOZZgYp6b3I3t2LSLhA77/uX096VDg== 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=aTxfBI943Xz904QZI71rENW0fo91agoh3SfdF/GnC0Q=; b=gOPcy9/eMM3tm49+hyqo6N0s1k8KiER498IwCv6+FT3HwasA6BJbxKZ4v3n9Rrz16wBmigaDkt9FdW9WnDfpOEOCS6X5gzdWriboH9QdyKlmC4rZbDn5So9r+3RlxXppkmX5DoonF2B5PFDq9BtD/2tGVNLYmaQn9IcdQyas1A4= Received: from MW4PR03CA0330.namprd03.prod.outlook.com (2603:10b6:303:dd::35) by DM6PR12MB3500.namprd12.prod.outlook.com (2603:10b6:5:11d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.20; Mon, 9 May 2022 14:55:53 +0000 Received: from CO1NAM11FT064.eop-nam11.prod.protection.outlook.com (2603:10b6:303:dd:cafe::33) by MW4PR03CA0330.outlook.office365.com (2603:10b6:303:dd::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.20 via Frontend Transport; Mon, 9 May 2022 14:55:52 +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; Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT064.mail.protection.outlook.com (10.13.175.77) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5227.15 via Frontend Transport; Mon, 9 May 2022 14:55:52 +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.24; Mon, 9 May 2022 09:55:46 -0500 From: Yazen Ghannam To: , CC: , , , , Yazen Ghannam Subject: [PATCH 03/18] EDAC/amd64: Remove PCI Function 6 Date: Mon, 9 May 2022 14:55:19 +0000 Message-ID: <20220509145534.44912-4-yazen.ghannam@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509145534.44912-1-yazen.ghannam@amd.com> References: <20220509145534.44912-1-yazen.ghannam@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e753c905-2856-43c5-7893-08da31cc037f X-MS-TrafficTypeDiagnostic: DM6PR12MB3500:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3n+Ls9HZDd3WAChrnpKIz6qwumMVr/bCMwnXXy8yhna60GgcXOkxMNp8BfPu8a6JLPElbQ1IUtDUElSjBLPh5pdZyfuzpLa3o2Pan24IVyH6HS++P2h1EJoVvMho9tEo6TrwT0zs5kDxkgwYEYKNgVCTfNof0dNhx14j9GEVtczaWdJJqZIV1nw01WY4FwSKtuvAkH7Um6pY06Lw9LiF0tXcQdnFHq7ICTGaEnJw2tg1zfzRVZr+qG1NWam1hM81mzWQ/EciIqh5JLuBrLoyvcyv8J4/fg9oZWr7k5qYCLoqYl9b78EONbSXrC0zTHqY2JCVaTSPmLEvJ4Xm0nn5eXl5zgiWjYs5FEyOfZfbEY2y788mMzqz9/3ihk+0ogP3HGrNoSJaqor2UdJhyyY0prtx2mVuaC/R+GsLNZBKkY6Pv6AGZklCjywOwFG2UG7wVjnRL82A1FJDuhIb17rPTsaCa+jkFOyCaijTseyqoyWSXO9SJmtLZveGr1DZGgqF1K2GlWHr42v/hAwkk2CbeG1vBoOyEThSyDKPJt2283CYYyQfpNK6rUeWuaDaEO18OFkk6iQnrPwCM9t/dZo3eOnPcbSLytg6cKpeRP5BW+2qfquX9AvgTjThRmw5wlRdb38y91cHi7BqjtTbNZYpPdEI7bgkuYdoxlmh2/Q5p4B/s8mCrCEvApPSP+5/JKjWWdgYc+gWnIhFMdPoXmkYmA== 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:(13230001)(4636009)(40470700004)(36840700001)(46966006)(508600001)(316002)(8936002)(36860700001)(110136005)(16526019)(54906003)(8676002)(356005)(4326008)(86362001)(70206006)(70586007)(44832011)(26005)(83380400001)(6666004)(40460700003)(7696005)(186003)(1076003)(2616005)(426003)(336012)(82310400005)(2906002)(47076005)(36756003)(5660300002)(81166007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 May 2022 14:55:52.6246 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e753c905-2856-43c5-7893-08da31cc037f 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: CO1NAM11FT064.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3500 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 --- drivers/edac/amd64_edac.c | 22 +--------------------- drivers/edac/amd64_edac.h | 10 +--------- 2 files changed, 2 insertions(+), 30 deletions(-) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 3ec7eb4ceb4e..b2f7c14a287c 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -2911,7 +2911,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, @@ -2921,7 +2920,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, @@ -2931,7 +2929,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, @@ -2941,7 +2938,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, @@ -2951,7 +2947,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, @@ -2961,7 +2956,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, @@ -2971,7 +2965,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 = { @@ -2982,7 +2975,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, @@ -3295,7 +3287,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) @@ -3307,21 +3299,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; } @@ -3357,7 +3339,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); @@ -4080,7 +4061,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..2c7b49479aa9 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 @@ -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 Mon May 9 14:55:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 12843725 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 233DAC433EF for ; Mon, 9 May 2022 14:56:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237900AbiEIO7z (ORCPT ); Mon, 9 May 2022 10:59:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237881AbiEIO7v (ORCPT ); Mon, 9 May 2022 10:59:51 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2074.outbound.protection.outlook.com [40.107.243.74]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A7941DF675; Mon, 9 May 2022 07:55:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EmPDcfN6UexRa53tyOo1wfkQdsUX4iZCXO08xM2l008ii7Ly6pVmFM6JsvPdTOS1sKufl0E4vdXP1v1wcS4D0+dP9xmMsSw7zzKOMPEIZFHLpsYEfBvAHFm92vfLsVjfWO44oyPaFWktJe5yVGytXfqS8ZksmiVraJd+EHJPubNtahkiZqAsz00bO8BA1WjIc0Q/exPEFBA6Ra0GIIJf+bFncbBKj9TH2ewJMda/IfAy2R0Gf+Qi50SttLnsxNR4z0IlKhVa2dXUSN24rohmyyzEnt92CBna2DjXgdDTnfO0mXVMlMaPB1NiUdHAz8MOcFZjBLddCJmPlVDWtG1sjw== 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=hMqLXKeMtVGZjtFuvJdOPW1/96HQ5OBKclba9OJjhaM=; b=GWETnVDei8Sk3jrRLmsolbHlUmXsLx0y9d2cV/80qMuN+4FMcL+AXQeLa0ieDTGtR0Y0NEVeiybYh9nWBwtBZsPvSSslhnFuky9Ktt1a3RGyvgTjHm0rPaj0XVJKf2RzhK2Nz9mY+qnQrS0d5A7RgjNdsIu4vcJ9GG967QdUspvhZAdHVDUcVEiou8uejoNS2SeQaE9/vbavr9Mwc4Jw7Z/pzwkdGuWtmLeBv5+hjnvUGdpONoctFTGihh/rc90rB1Rl8dkkl7qS5kwJdh63aqZGVhdNMCZgPy6IFbeIWr/dMenPLow3y6Zk4F4F561NuThLCRjImsF5n+OWZJ+ItQ== 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=hMqLXKeMtVGZjtFuvJdOPW1/96HQ5OBKclba9OJjhaM=; b=zVJ5kYMMJE+JEdOPZ1V74OKJxYwTz1ptfkgib2ZF5UHTrzFqfpQHlKcrxUPHI5rWJGy1PFDsMg8GJcm1pyBXr5nZAhGJFu5IBrp4CLcCDxYlR52knZeNafRrq8CuMaln2THu6DiwJVL/tH1aeJpiJkRtUNWwgyHwukAJ+bMY8+c= Received: from MW4PR03CA0319.namprd03.prod.outlook.com (2603:10b6:303:dd::24) by BYAPR12MB4982.namprd12.prod.outlook.com (2603:10b6:a03:106::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5206.25; Mon, 9 May 2022 14:55:54 +0000 Received: from CO1NAM11FT064.eop-nam11.prod.protection.outlook.com (2603:10b6:303:dd:cafe::e4) by MW4PR03CA0319.outlook.office365.com (2603:10b6:303:dd::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.20 via Frontend Transport; Mon, 9 May 2022 14:55:54 +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; Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT064.mail.protection.outlook.com (10.13.175.77) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5227.15 via Frontend Transport; Mon, 9 May 2022 14:55:54 +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.24; Mon, 9 May 2022 09:55:47 -0500 From: Yazen Ghannam To: , CC: , , , , Yazen Ghannam Subject: [PATCH 04/18] EDAC/amd64: Remove PCI Function 0 Date: Mon, 9 May 2022 14:55:20 +0000 Message-ID: <20220509145534.44912-5-yazen.ghannam@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509145534.44912-1-yazen.ghannam@amd.com> References: <20220509145534.44912-1-yazen.ghannam@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 731666e1-77e9-4c0c-7d62-08da31cc046b X-MS-TrafficTypeDiagnostic: BYAPR12MB4982:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RS5vQz/zJ6MJdcIhpeVTx292jlLeN9PaKeM4pLADotmUoQGOrY+aMzHALXnF6GuMqr4gFsh5AYIL3qTL/rhBVlkkQiU3WpDkC0/D6p87ikSi7q2Qjl8I8ppCWUxjQIVG18HEN23B8e3rjkUG0+G5+QHVMqsi4EhZjzFlv6ZxKctoeq0GaTLo6j7R7DvqSom23PYRcbnsEqVCiKc0K7gng++5fmM+ojCO1JZUM71Jm43wDpRdnotF3/DDSRYr12s1JTSMciCdg7SBBFlN54Orq7D26HhLl7ZOPsjpLNJft2YhfnQ+Gp10p2Vor4lHfNCG48bchFdhLpz//tp7AP7g9OGeD4vFspEczTIRPCEn4rXbN2i9DE9yyUQ1Ki4fG4qGpjEczpF5QzuovXXOflWIr4Up2IJG4EtPQWiZ4RwI9/mmTVpihXSUCUMXshaCjWbNCvNYA4H1YTPvoVEiIc/dMYvipwEMyanW9QTH/d/x+qPBMKBd2dGHECypZ4Gtu/VjyJs/47Tn0yuW2A3v7/Ht7tL+WIpy3AAsEHpFWHShw5Q1poij1tFzT4TlWEJd5rHPCRK2ImsfJZeoggQOd+yrGB+m5BmlYDKbcJxQGn81LQQEGxnIXjdY0uuKo8dL4ah1ghWaBBoACJ/Qqvcwz0c7C20rTOdNR5BpAHnEOJaQsjxsA6Puuw66MM6DFC75wqruRKpM++XEdlsAjh5d3ADXNg== 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:(13230001)(4636009)(40470700004)(46966006)(36840700001)(8936002)(47076005)(2616005)(16526019)(186003)(1076003)(336012)(6666004)(426003)(7696005)(36756003)(356005)(81166007)(86362001)(40460700003)(83380400001)(82310400005)(54906003)(36860700001)(110136005)(44832011)(5660300002)(508600001)(316002)(70586007)(8676002)(4326008)(2906002)(70206006)(26005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 May 2022 14:55:54.1714 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 731666e1-77e9-4c0c-7d62-08da31cc046b 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: CO1NAM11FT064.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB4982 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 --- drivers/edac/amd64_edac.c | 38 +++++--------------------------------- drivers/edac/amd64_edac.h | 10 +--------- 2 files changed, 6 insertions(+), 42 deletions(-) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index b2f7c14a287c..e0f99b8edc97 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -1433,9 +1433,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. */ @@ -1470,6 +1467,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. */ @@ -1480,8 +1479,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); } @@ -2910,7 +2907,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, @@ -2919,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, .max_mcs = 2, .ops = { .early_channel_count = f17_early_channel_count, @@ -2928,7 +2923,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, @@ -2937,7 +2931,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, @@ -2946,7 +2939,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, @@ -2955,7 +2947,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, @@ -2964,7 +2955,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 = { @@ -2974,7 +2964,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, @@ -3287,26 +3276,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); @@ -3338,7 +3313,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); @@ -3428,7 +3403,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; } @@ -4059,8 +4033,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; @@ -4077,7 +4049,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 2c7b49479aa9..7cfac50d6558 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 @@ -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 Mon May 9 14:55:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 12843730 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 A0596C433EF for ; Mon, 9 May 2022 14:56:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237932AbiEIPAB (ORCPT ); Mon, 9 May 2022 11:00:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237890AbiEIO7y (ORCPT ); Mon, 9 May 2022 10:59:54 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2084.outbound.protection.outlook.com [40.107.223.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A11BB24D625; Mon, 9 May 2022 07:55:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GcB8BthxMk0mNQovMnxevWsHtnVfmvAQu24W5H7vIvVy89qMTxFmeT8oBU/R770EDd4atin5HrHuILoYmhPNlHxiQJsNFV8qQblJdigCZYFAmLmNuv3MvxXUgfd132oQu7grUufAM1KimlGgyp7XRJXNeYQZnjFaaN8JZUysQZy/POPaC0fKDGCA2sKElh51Tnd8dOLM9eCGDEW7Wu9AzFRD97lUpM3Ta+IBjYJL3Hnq81ZDswrVOJS7E+x9yGkhbOUcOdBML9YpkXVglvaBeAu3vdVqJfqSxQv47YEe5ERZ9i33OmU0p1g2a3bnNBjRIaBHX6UvSLBvbxYU0F5rjw== 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=Jp84w/f/1ll8rRuNXNX7kNxM8/ZJrUfBIZsMpfKbGUk=; b=CsdZtmvRpKY/Te9N5ZvqmXm95goT+kiYF+SNwVAPlB+mwCWZ5IFuMpMawq2V4E7PIn9nd/epQ8c9QEwvlSLrzxlouniwrx2LtZp/4IrweHU4aAbCM2qgvO4bKV4lQ09z0Q9IZKqni7+uYZqek2GP/QXmhkOjmM0Z+w1idoLrUurwH9o1vDEYQRcpCzaD/YltaLfM7CQSxG6UwXHwyN8Y8YlGWFQabFkYrh/kDxDb7g99TC6DYMUKBTxFkpbCZKOxQlqIB23EVEF6Ce+Nm+SaN4Nmns7i/gz1rgl5+E2StHydU07FZV5saKbv7YCXQxUSp1yaeBxzrh/lNzq1jDmEBw== 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=Jp84w/f/1ll8rRuNXNX7kNxM8/ZJrUfBIZsMpfKbGUk=; b=30B0pqGUKv0Ylkcdtt3OCLdMlbpqkAFWhOo0mTC0+nW1+uX6/WS76473KEDNFPZpyDaV87j4QmJhWBjuzpgi2q5utv9i6LC15M3WhjVxwS9t4p51xm7QftSpdjg9ur2xsyDPzOSKp9YdcF6bd9eqjv7UMVBIEDk8aE3EX5x/Bx0= Received: from MW4PR03CA0013.namprd03.prod.outlook.com (2603:10b6:303:8f::18) by CH2PR12MB4040.namprd12.prod.outlook.com (2603:10b6:610:ac::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.21; Mon, 9 May 2022 14:55:55 +0000 Received: from CO1NAM11FT009.eop-nam11.prod.protection.outlook.com (2603:10b6:303:8f:cafe::42) by MW4PR03CA0013.outlook.office365.com (2603:10b6:303:8f::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.22 via Frontend Transport; Mon, 9 May 2022 14:55:55 +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; Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT009.mail.protection.outlook.com (10.13.175.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5227.15 via Frontend Transport; Mon, 9 May 2022 14:55:54 +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.24; Mon, 9 May 2022 09:55:47 -0500 From: Yazen Ghannam To: , CC: , , , , Yazen Ghannam Subject: [PATCH 05/18] EDAC/amd64: Merge struct amd64_family_type into struct amd64_pvt Date: Mon, 9 May 2022 14:55:21 +0000 Message-ID: <20220509145534.44912-6-yazen.ghannam@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509145534.44912-1-yazen.ghannam@amd.com> References: <20220509145534.44912-1-yazen.ghannam@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bdbb7a10-1f44-4a70-7174-08da31cc0484 X-MS-TrafficTypeDiagnostic: CH2PR12MB4040:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RlhLkyWSn0ZHHBaEGqj7mXmt+aFGp+T+Jhxka23ppym8Z8lYb9cyqJMqUfYOxu8qJ9eDQRFKdKOdN6eIa3jkmmUO40Ys8MM9B4W4Aiye920uwflQxowIAtfPBIHqFgEk9aPWmULiM/T2F8xNbDi1SbDo9RblhTehFbMMdwCNR1BHmFWk88ZUv9FwQ1IkqV+oVEKlIvx+2FZSmSU8JK8MSYMLyJPXsXs8sgnEx4ONZFIs0RmuRV4dTX7NwVbNGy/fLWaBlra2YPc0ZSdq47+3Z7LuB8Dj6WuSvSmsWIeL0rYySMY+/napAra3kybI47kYXDBISl7ooy7wXVq6+EUk73Xrtb6chgbAsx6tkOCgdGaJjf1yTPc1CuOw1GpkRqbjGZQJuYYhuYHYYdkuy/Pm9oAVZUhlvYrP6ujrqviwQVN9ZRpYvyJEmqKOcNm47Mgpsf7B6+83s0kG6Kmm3MOUzHasHWNrS/EnIQFb1HVyJDtJ2vNVyERHpTvnjzbj/YPs6S46sfZX1ZfwIsQdnKjhYHx96Pt4VCWlUjyuqwqv88kykoalnXm2RpWOOvoD0HwqTsM+zmk5PgOhC0TIQkWoc/Av3r5vnGGHZ8cIFQOI/4ASSvPH/Aq9V2lxAi42DdrcqVZDlq3+8HyqkrLygaZtJcc/XbU3s2LWQTm6Q1Y8DGbhjIk0udEmxMkm6jRP49UUiDr7hUmvHzcNHBLXf19u0A== 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:(13230001)(4636009)(40470700004)(36840700001)(46966006)(2906002)(86362001)(8936002)(7696005)(6666004)(508600001)(44832011)(30864003)(81166007)(83380400001)(356005)(5660300002)(26005)(2616005)(36860700001)(40460700003)(336012)(16526019)(47076005)(1076003)(186003)(426003)(54906003)(70586007)(110136005)(316002)(70206006)(4326008)(82310400005)(36756003)(8676002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 May 2022 14:55:54.3349 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bdbb7a10-1f44-4a70-7174-08da31cc0484 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: CO1NAM11FT009.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4040 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. Rename the Family 17h functions to use a "umc" prefix. This is to indicate that the functions apply to all modern CPU familes (17h, 18h, and 19h) which all have Unified Memory Controllers (UMCs). Signed-off-by: Muralidhara M K Signed-off-by: Naveen Krishna Chatradhi [Rebased/reworked patch and reworded commit message] Signed-off-by: Yazen Ghannam --- drivers/edac/amd64_edac.c | 353 +++++++++++++------------------------- drivers/edac/amd64_edac.h | 66 +++---- 2 files changed, 140 insertions(+), 279 deletions(-) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index e0f99b8edc97..3d569290d4cf 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) { @@ -442,7 +440,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 @@ -1425,7 +1423,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)); @@ -1498,7 +1496,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 { @@ -1538,7 +1536,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]; @@ -1626,7 +1624,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)) @@ -2027,7 +2025,7 @@ static int f1x_early_channel_count(struct amd64_pvt *pvt) return channels; } -static int f17_early_channel_count(struct amd64_pvt *pvt) +static int umc_early_channel_count(struct amd64_pvt *pvt) { int i, channels = 0; @@ -2167,7 +2165,7 @@ 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, +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; @@ -2207,7 +2205,7 @@ static int f17_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. */ @@ -2827,151 +2825,6 @@ static void debug_display_dimm_sizes(struct amd64_pvt *pvt, u8 ctrl) } } -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 = { - .early_channel_count = k8_early_channel_count, - .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 = { - .early_channel_count = f1x_early_channel_count, - .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 = { - .early_channel_count = f1x_early_channel_count, - .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 = { - .early_channel_count = f1x_early_channel_count, - .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 = { - .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, - } - }, - [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 = { - .early_channel_count = f1x_early_channel_count, - .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 = { - .early_channel_count = f1x_early_channel_count, - .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, - .ops = { - .early_channel_count = f17_early_channel_count, - .dbam_to_cs = f17_addr_mask_to_cs_size, - } - }, - [F17_M10H_CPUS] = { - .ctl_name = "F17h_M10h", - .max_mcs = 2, - .ops = { - .early_channel_count = f17_early_channel_count, - .dbam_to_cs = f17_addr_mask_to_cs_size, - } - }, - [F17_M30H_CPUS] = { - .ctl_name = "F17h_M30h", - .max_mcs = 8, - .ops = { - .early_channel_count = f17_early_channel_count, - .dbam_to_cs = f17_addr_mask_to_cs_size, - } - }, - [F17_M60H_CPUS] = { - .ctl_name = "F17h_M60h", - .max_mcs = 2, - .ops = { - .early_channel_count = f17_early_channel_count, - .dbam_to_cs = f17_addr_mask_to_cs_size, - } - }, - [F17_M70H_CPUS] = { - .ctl_name = "F17h_M70h", - .max_mcs = 2, - .ops = { - .early_channel_count = f17_early_channel_count, - .dbam_to_cs = f17_addr_mask_to_cs_size, - } - }, - [F19_CPUS] = { - .ctl_name = "F19h", - .max_mcs = 8, - .ops = { - .early_channel_count = f17_early_channel_count, - .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 = { - .early_channel_count = f17_early_channel_count, - .dbam_to_cs = f17_addr_mask_to_cs_size, - } - }, - [F19_M50H_CPUS] = { - .ctl_name = "F19h_M50h", - .max_mcs = 2, - .ops = { - .early_channel_count = f17_early_channel_count, - .dbam_to_cs = f17_addr_mask_to_cs_size, - } - }, -}; - /* * These are tables of eigenvectors (one per line) which can be used for the * construction of the syndrome tables. The modified syndrome search algorithm @@ -3368,7 +3221,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); @@ -3897,7 +3750,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; @@ -3906,114 +3759,149 @@ 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 = { + .early_channel_count = umc_early_channel_count, + .dbam_to_cs = umc_addr_mask_to_cs_size, +}; + +/* Use Family 16h versions for defaults and adjust as needed below. */ +static struct low_ops dct_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, +}; + +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->early_channel_count = k8_early_channel_count; + 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; + case 0x10 ... 0x1f: + pvt->ctl_name = "F19h_M10h"; + pvt->max_mcs = 12; + pvt->flags.zn_regs_v2 = 1; 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 0x20 ... 0x2f: + pvt->ctl_name = "F19h_M20h"; 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 0x50 ... 0x5f: + pvt->ctl_name = "F19h_M50h"; 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 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[] = { @@ -4030,12 +3918,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); @@ -4081,7 +3969,7 @@ static int init_one_instance(struct amd64_pvt *pvt) * 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].size = pvt->max_mcs; layers[1].is_virt_csrow = false; mci = edac_mc_alloc(pvt->mc_node_id, ARRAY_SIZE(layers), layers, 0); @@ -4111,7 +3999,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); } @@ -4140,9 +4028,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); @@ -4181,11 +4068,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 7cfac50d6558..a4a27208532c 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,11 +315,21 @@ 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; /* pci_device handles which we utilize */ - struct pci_dev *F0, *F1, *F2, *F3, *F6; + struct pci_dev *F1, *F2, *F3; u16 mc_node_id; /* MC index of this MC node */ u8 fam; /* CPU family */ @@ -376,6 +367,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; @@ -466,30 +463,11 @@ 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, - 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; + int (*early_channel_count)(struct amd64_pvt *pvt); + 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 Mon May 9 14:55:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 12843727 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 34232C43217 for ; Mon, 9 May 2022 14:56:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237906AbiEIO74 (ORCPT ); Mon, 9 May 2022 10:59:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237884AbiEIO7w (ORCPT ); Mon, 9 May 2022 10:59:52 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2057.outbound.protection.outlook.com [40.107.93.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D73471E029C; Mon, 9 May 2022 07:55:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SueeOEINKJnnJjtoCM+ZjGMWQcFzh8A2hb41cLWHGJclJTsIZd75+zbmSseOeGcwaYL3/knPMONPYLqMf9ORWzaCyOTZDw8jzQGwbYM5yrETEdB7Oh+L+UnT1li+4rhTSmsJvII+Sz2mUhY04rTMRRE7ymUkD+flTqHsmJIuJlXyKqDPsRS72BHf4uXY0qWf+mdEPWJh87KBZYo/s/kyJ2Vzgvf5km3ViQJ6O1u3+jDxzTkmfM6YU9nOQpUKI2qegPHClHUZuJOu+edFmMXKhNrcYkUZjfXJKx/moz5+ZXzJrRpyp5nj5emJExLpzX73N5mygQN13hiyVv6odYq//g== 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=6viuKJ5ijqFe/qBbXl8RLDjPmH2QQGrl51fM07ApIGo=; b=dgvGV9LIvHLOeI64JoxpSZqRsukK7+FDo7Hw8BStAoak8mlAiTB4eEQyDUjyFDHtN9lInhFFiwpQiShOFuyWNVPpPRzgInnT+GoSqPJad6RDYQqzCLPZgUSI7wHgTBR+kcr02OWUH74xaa5sPcCsZC465mMGmRtDVfTUOzppc6eYfFEwP2YVzfT58Cdl0XNMQuduqKNk6833QmImuWRd/LHnFe79IeaUsQYnlt+YTYlEdjyGbyPD+s5GiykH3qSqBJA7Z7s6SA/frztTr8XWkfkTFj5uLm+3h5mddrJIwYnEcuTZKR6P1rPLFABW+HhGfqBNkB7HY9JE3nCK9EMjoQ== 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=6viuKJ5ijqFe/qBbXl8RLDjPmH2QQGrl51fM07ApIGo=; b=b8BDAVfUkwxsVGnf/D8yM4F9mp7nzXLPsqFdDGF6ru9mpQateuSaeICtqI6vvNeSEycGKUp8Ui/ja6EIRPqZkOPRVZ9JzF/v+WJ8mnJhTSffXYLeRUmo1atNBO9pN/4zLReKy8CKwaxVCyYM+fuomgoxSKk1cO6vbjVSShWGgd8= Received: from MW4PR03CA0312.namprd03.prod.outlook.com (2603:10b6:303:dd::17) by BYAPR12MB3573.namprd12.prod.outlook.com (2603:10b6:a03:df::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.23; Mon, 9 May 2022 14:55:55 +0000 Received: from CO1NAM11FT064.eop-nam11.prod.protection.outlook.com (2603:10b6:303:dd:cafe::43) by MW4PR03CA0312.outlook.office365.com (2603:10b6:303:dd::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.21 via Frontend Transport; Mon, 9 May 2022 14:55:55 +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; Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT064.mail.protection.outlook.com (10.13.175.77) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5227.15 via Frontend Transport; Mon, 9 May 2022 14:55:55 +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.24; Mon, 9 May 2022 09:55:48 -0500 From: Yazen Ghannam To: , CC: , , , , Yazen Ghannam Subject: [PATCH 06/18] EDAC/amd64: Add prep_chip_selects() into pvt->ops Date: Mon, 9 May 2022 14:55:22 +0000 Message-ID: <20220509145534.44912-7-yazen.ghannam@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509145534.44912-1-yazen.ghannam@amd.com> References: <20220509145534.44912-1-yazen.ghannam@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6f4a49c8-21cb-4b07-9c88-08da31cc04ee X-MS-TrafficTypeDiagnostic: BYAPR12MB3573:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pI8m5LIG4W6dNXwq2WMATFt6GyQiu76EQ/LyarHY1MEBNI9tQYakmJ4RJvXNNvWIMVQi9vVjEti2pmzXpmY9UYtcXEm2svA3poUGFsOzLFslNyWdc3c3v3nXVSFXnhEoV6CgGewBj9IA6R5JCaDlOHV0gdKzSf718Xs31ZsyDgueizxhCxQHsVO8/gLI+xsZ6wGO7az3YzghWXsSU+LwOdGSx1C5kS+K/iN8+YVM8XadxUyDztF/iKlsgS8F5Z3SQk0GHs6Q7AlGOOdgSVltJqeVmtS5HYRZrQcl/CbAvJ76HGcX8jNyQi4UuoLEWF6C6kIjFyQKhS+Rs5+NHSwpIWB8YB7qYEULhifMh8C9IZK+IQHrFFlYtnJrfOyiiyLPboZ40Wkv3gpeKvCGcbJsRUS2Tymo0BMFjL8Rm93uYmVjlVNNN6UPs4PWIj1OFwYdPcEFKLz6Afdgby5GVsRKSPvBJKCcMSQbye1wPJIcSOhtL3FH/9DyfwhiVTM8Df4clTxDKoYnr0267EPa5QnuHcSb+RW9v8YFft209611v+WnxL3n54NS95fWc1UkZ4ufKM2g68SKiImHSC6SXtwCxnPrdSsENfZ+1PclOo5OIXdi7mpUl4gbKzRqDLE907H7sOvWxXQAERw4oZ2M/vbuZY7LUOvy/m/3mdSrx1Gg+MuZCQ2zNQL2URwB1K6Y676gJzm9cD4Tm12o8JF7OPv1rQ== 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:(13230001)(4636009)(40470700004)(36840700001)(46966006)(83380400001)(186003)(508600001)(16526019)(36860700001)(2906002)(1076003)(110136005)(44832011)(26005)(2616005)(36756003)(47076005)(82310400005)(40460700003)(336012)(426003)(6666004)(356005)(7696005)(86362001)(5660300002)(8936002)(70586007)(54906003)(70206006)(8676002)(81166007)(4326008)(316002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 May 2022 14:55:55.0307 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6f4a49c8-21cb-4b07-9c88-08da31cc04ee 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: CO1NAM11FT064.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB3573 Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org From: Muralidhara M K GPU Nodes will need to set the number of available Chip Selects, i.e. Base and Mask values, differently than existing systems. A function pointer should be used rather than introduce another branching condition. Prepare for this by adding prep_chip_selects() to pvt->ops and set it as needed based on currently supported systems. Use a "umc" prefix for modern systems, since these use Unified Memory Controllers (UMCs). Use a "dct" prefix for newly-defined legacy functions, since these systems use DRAM Controllers (DCTs). Signed-off-by: Muralidhara M K Signed-off-by: Naveen Krishna Chatradhi [Rebased/reworked patch and reworded commit message] Signed-off-by: Yazen Ghannam --- drivers/edac/amd64_edac.c | 26 +++++++++++++++----------- drivers/edac/amd64_edac.h | 1 + 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 3d569290d4cf..f8cd89278753 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -1483,7 +1483,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; @@ -1491,20 +1491,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; @@ -1563,8 +1565,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); @@ -3301,6 +3301,8 @@ static void read_mc_regs(struct amd64_pvt *pvt) } skip: + pvt->ops->prep_chip_selects(pvt); + read_dct_base_mask(pvt); determine_memory_type(pvt); @@ -3762,6 +3764,7 @@ static void setup_mci_misc_attrs(struct mem_ctl_info *mci) static struct low_ops umc_ops = { .early_channel_count = umc_early_channel_count, .dbam_to_cs = umc_addr_mask_to_cs_size, + .prep_chip_selects = umc_prep_chip_selects, }; /* Use Family 16h versions for defaults and adjust as needed below. */ @@ -3769,6 +3772,7 @@ static struct low_ops dct_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, + .prep_chip_selects = dct_prep_chip_selects, }; static int per_family_init(struct amd64_pvt *pvt) diff --git a/drivers/edac/amd64_edac.h b/drivers/edac/amd64_edac.h index a4a27208532c..0a7738df396f 100644 --- a/drivers/edac/amd64_edac.h +++ b/drivers/edac/amd64_edac.h @@ -468,6 +468,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); + void (*prep_chip_selects)(struct amd64_pvt *pvt); }; int __amd64_read_pci_cfg_dword(struct pci_dev *pdev, int offset, From patchwork Mon May 9 14:55:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 12843726 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 BD815C433FE for ; Mon, 9 May 2022 14:56:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237905AbiEIO7z (ORCPT ); Mon, 9 May 2022 10:59:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237885AbiEIO7w (ORCPT ); Mon, 9 May 2022 10:59:52 -0400 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam08on2049.outbound.protection.outlook.com [40.107.100.49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A64018368; Mon, 9 May 2022 07:55:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B+PUUheyhJHGxZgI8l5HqIqOBeQBvxgdK5pdfxZp7gBV2T4SS/0n6IuIMKTp6jhsPWywqTg+ldjdWuti88qNotKQW2lQcl7w99uYVWQcy/H+ZquQcq+DT+CCm8D4X3tJTQNCC+s7iQhZbPAMhbPQGvTQiO7uNK7VMIkZE9ervCS/hbFglFDNBTWaa1AJ6bZ3C1itpadCQh/DJKbpc5tIfolkf/K/pzgoVORDbasDpaz7RgKKgaudiu5tTsUxerUx3SOCO0ufSiljVadWeLYgUODjKn63YBH5ICfkGAAjA+qUKhaVGqsXoFEb+XUYDCjxyjdwWnFrtR1z0x8GTZ006A== 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=Vd+tx1HV8TBhEFCi2OUpe8LwXMdrzIk+C9eZWBM6IL0=; b=EsNflnegwZ8WtIbdMq6g0A+t36Cq5W7HMnCPvhJwxuFBHLZF82fXDQuDnDd/6uBXeIwAsMYlu5DX/5aDX/lmI1UxLXzu9Ol+UDberGnyNIb4qlfzFr71YikhM3KU0b46X+/Ewrd8gUlfML6VmOuWgpCAs+5tnw3jmgbSu3SA5Yz+R07DB6pD9L9o4G+5ofSc6UYj/HhAqKzi8HppVzE7EhntyQ6XLtxhnum6OsOsnx/p+nWYHyDUto9C104oAOEAZ+YIKFFGXH3SBCvgo3gr7eWcj92ohw4ZPBqlkCHg5XHFTPNAdLW84roK3uf3bZ3lHxDa+CoVD7ZLDvOW4Iy+Hw== 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=Vd+tx1HV8TBhEFCi2OUpe8LwXMdrzIk+C9eZWBM6IL0=; b=fH2gcdHUBivje+avS/TzHJ6Ad7xhKpBSYAbnvoEcCK9JWZ9qlgTHkK91qbQ+UvT03THSGxR65ceJCzdrAZyrqS4yrFQpAUH485gVmOFX9xLlEKCOH6hisL6yQPl9seMA3spdLdZY7CwW3PzmgVXXinz7DAqUbK6D+ZcVg1IbyMI= Received: from MW4PR03CA0021.namprd03.prod.outlook.com (2603:10b6:303:8f::26) by BL0PR12MB4691.namprd12.prod.outlook.com (2603:10b6:208:84::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.20; Mon, 9 May 2022 14:55:56 +0000 Received: from CO1NAM11FT009.eop-nam11.prod.protection.outlook.com (2603:10b6:303:8f:cafe::9b) by MW4PR03CA0021.outlook.office365.com (2603:10b6:303:8f::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.21 via Frontend Transport; Mon, 9 May 2022 14:55:56 +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; Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT009.mail.protection.outlook.com (10.13.175.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5227.15 via Frontend Transport; Mon, 9 May 2022 14:55:55 +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.24; Mon, 9 May 2022 09:55:48 -0500 From: Yazen Ghannam To: , CC: , , , , Yazen Ghannam Subject: [PATCH 07/18] EDAC/amd64: Add read_base_mask() into pvt->ops Date: Mon, 9 May 2022 14:55:23 +0000 Message-ID: <20220509145534.44912-8-yazen.ghannam@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509145534.44912-1-yazen.ghannam@amd.com> References: <20220509145534.44912-1-yazen.ghannam@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c7528b3a-4d69-4d4b-c5d4-08da31cc055f X-MS-TrafficTypeDiagnostic: BL0PR12MB4691:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qFLGaqJu5jIFC7t7iQzxIdUACCvAmGOLqvXYYqVg/DuzPZk6HhfMzIBqe3wE9CE+/Vkl7zKzvx/hOe8xcWPOMDBI60ayKTkhBBoVraNtiVdpZHdGz7KZXc3h++wjdgnUZlMlsT1KMFas38DrN7jbo0j1af6nTKkAS2CD1NnBkhd/9WHEy70Ct7QOy6eBpsAq77vQiiHa/ADapJLBvf4bzv1nL6zASqNSM+P7PWQJmMuq4QaO1LCHUI2HhpFe3vBe9ScD4WkPHh85/4YnssenWHkESnIfqXq/dBeAmMlReYpQasOg0eLCyDIl20NTp+xh3tgXuC5GMRgTVuFE25vLpS1Ssim8isoYvuJzCX3KGzAc+ugDfi3KjpcWNLeGuQWCDtLRkn5Oekdd7immDHSJlHyXwHG+JqX0CQSqVerdBvhv0+5DFRzAqVTcUyKRAy55RxPZv7Mh43b80mj+UGKnoh7FhTodCsd8MwqorXz6mDs4fgGW9iSITScUveyyn/ggxEAfDUgxPHSi5GAvtffNEG8t9z33Tlfjyu8QdOkkY8BC6meorkmZXlTqR3urvdevvGY8dD+FgvSVeYRT8at0w0rNW/4WjD3V02pEbF9k/5cIbAfz9dxT45cAxOBpm1LPQj1hL1Xsj8PlNGiNN8El/ZoMaNM8tjWkQIvPyXEYyr8mR5YcKmiUQAxJSFcsCx1us21+s0RgymYjf2xxzpe8bA== 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:(13230001)(4636009)(36840700001)(40470700004)(46966006)(70206006)(316002)(426003)(47076005)(508600001)(70586007)(44832011)(186003)(7696005)(16526019)(81166007)(2906002)(36860700001)(110136005)(40460700003)(54906003)(8676002)(4326008)(336012)(6666004)(26005)(356005)(82310400005)(2616005)(83380400001)(8936002)(1076003)(5660300002)(36756003)(86362001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 May 2022 14:55:55.7879 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c7528b3a-4d69-4d4b-c5d4-08da31cc055f 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: CO1NAM11FT009.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR12MB4691 Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org From: Muralidhara M K GPU Nodes will need to set the read the Base and Mask values differently than existing systems. A function pointer should be used rather than introduce another branching condition. Prepare for this by adding read_base_mask() to pvt->ops and set it as needed based on currently supported systems. Use a "umc" prefix for modern systems, since these use Unified Memory Controllers (UMCs). Use a "dct" prefix for newly-defined legacy functions, since these systems use DRAM Controllers (DCTs). Signed-off-by: Muralidhara M K Signed-off-by: Naveen Krishna Chatradhi [Rebased/reworked patch and reworded commit message] Signed-off-by: Yazen Ghannam --- drivers/edac/amd64_edac.c | 11 +++++------ drivers/edac/amd64_edac.h | 1 + 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index f8cd89278753..6e26bbb73f81 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -1507,7 +1507,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; @@ -1561,13 +1561,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); @@ -3303,7 +3300,7 @@ static void read_mc_regs(struct amd64_pvt *pvt) skip: pvt->ops->prep_chip_selects(pvt); - read_dct_base_mask(pvt); + pvt->ops->read_base_mask(pvt); determine_memory_type(pvt); @@ -3765,6 +3762,7 @@ static struct low_ops umc_ops = { .early_channel_count = umc_early_channel_count, .dbam_to_cs = umc_addr_mask_to_cs_size, .prep_chip_selects = umc_prep_chip_selects, + .read_base_mask = umc_read_base_mask, }; /* Use Family 16h versions for defaults and adjust as needed below. */ @@ -3773,6 +3771,7 @@ static struct low_ops dct_ops = { .map_sysaddr_to_csrow = f1x_map_sysaddr_to_csrow, .dbam_to_cs = f16_dbam_to_chip_select, .prep_chip_selects = dct_prep_chip_selects, + .read_base_mask = dct_read_base_mask, }; static int per_family_init(struct amd64_pvt *pvt) diff --git a/drivers/edac/amd64_edac.h b/drivers/edac/amd64_edac.h index 0a7738df396f..c81cc7f5fc96 100644 --- a/drivers/edac/amd64_edac.h +++ b/drivers/edac/amd64_edac.h @@ -469,6 +469,7 @@ struct low_ops { int (*dbam_to_cs)(struct amd64_pvt *pvt, u8 dct, unsigned int cs_mode, int cs_mask_nr); void (*prep_chip_selects)(struct amd64_pvt *pvt); + void (*read_base_mask)(struct amd64_pvt *pvt); }; int __amd64_read_pci_cfg_dword(struct pci_dev *pdev, int offset, From patchwork Mon May 9 14:55:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 12843728 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 E706AC433F5 for ; Mon, 9 May 2022 14:56:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237908AbiEIO75 (ORCPT ); Mon, 9 May 2022 10:59:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237887AbiEIO7w (ORCPT ); Mon, 9 May 2022 10:59:52 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2077.outbound.protection.outlook.com [40.107.243.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F838268E8E; Mon, 9 May 2022 07:55:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SnL/RZXHkhVMpokc8i5i3aDl3Ul1FrUiK7Qk3O5tcORPIPzdvi9MW8B/ennxjp9Mao+gIBOd7pRixShAiWXQddw7nIa8HSJeOygBR4m84Z+gMuSqWw7YaEUWfDE6iWaeRfHlNteCVgegnDkzsNgMPqRhG+FztP2CfilydvIIdirbXRg7UDo0OFOwDQhQWmu19bJuLI1rbQTkfgUz11+0utKh11A2Oo8UQSNYwdncAg7B6x7O+Ze7TH+fra0M+ox+Wa7q/xEaWGdYrpDswphoQn3vLWd7YQkWIUAUxbzkh+FtYjz2cyJ5K+PRox4S2Vtkava7TsceRg6XyHYHhWHnAQ== 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=JTV4kOvmAPz8ymyzx0EcyPZFuHzGTaxJlCcMO/JUQhE=; b=cwiPxpbEyKLXu6fNStcj4LUiCujBw1pUaqq3N5I3w6DTquw3z2fuwsCQ6zu9EI5XwNQgeMAW+JAMF9EM4hgJ5SorrhvcT37mNAJbY2DTBcieItbCqi8nCXG/JgmmWofGE3cZOYvoWOmQGpfttMzja+LY9I++OaTeQp89gCpCrhcbzVFBWIeKvYkdk08RPEHB4NDDSO7TPB0hrPSeA5xZiJP+VKFOp8B0OvVzyw7Jtcsc7sTESoe7PkTgF/qM/5d75/b4q7+rWB2UqNtON9UzHSpP/eMUaOk+IaUdOS/EmEceE3hVWQOi+hr9g7Q/5IpgIYtdpK1OVJ6jxD34RI7hwg== 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=JTV4kOvmAPz8ymyzx0EcyPZFuHzGTaxJlCcMO/JUQhE=; b=o+GrLuVOaCq+Vl/JAwa1wr+ewYDAilQ+NQy6szHbt7oG5QeDNo5Lcx14vvnt9hyokNg1l5+qa2jDbYqTzOT7ayRvkIX+NhKX1j0vp9NljSn/uTgFCegQN79jABLEdfX7V45CZDSBHPaItVVsuQVvR7R49oXN5Uck7QQ7GwxuzSA= Received: from MW4PR03CA0302.namprd03.prod.outlook.com (2603:10b6:303:dd::7) by CH2PR12MB4296.namprd12.prod.outlook.com (2603:10b6:610:af::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.20; Mon, 9 May 2022 14:55:56 +0000 Received: from CO1NAM11FT064.eop-nam11.prod.protection.outlook.com (2603:10b6:303:dd:cafe::d7) by MW4PR03CA0302.outlook.office365.com (2603:10b6:303:dd::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.20 via Frontend Transport; Mon, 9 May 2022 14:55:56 +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; Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT064.mail.protection.outlook.com (10.13.175.77) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5227.15 via Frontend Transport; Mon, 9 May 2022 14:55:55 +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.24; Mon, 9 May 2022 09:55:48 -0500 From: Yazen Ghannam To: , CC: , , , , Yazen Ghannam Subject: [PATCH 08/18] EDAC/amd64: Add determine_memory_type() into pvt->ops Date: Mon, 9 May 2022 14:55:24 +0000 Message-ID: <20220509145534.44912-9-yazen.ghannam@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509145534.44912-1-yazen.ghannam@amd.com> References: <20220509145534.44912-1-yazen.ghannam@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 84e6ef3e-585e-4a3f-94b5-08da31cc056a X-MS-TrafficTypeDiagnostic: CH2PR12MB4296:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qU6ULGF3JOrkHQzmPKoNazHaEyp9yblMM7vGCk7Ixtqcwj3fFHcBvkG43dFVplEJIgRs+p78arf9vABjawgOJasZa7Cp1xFUAzUoHdoCjqSrtP0cVJCYdrMUHsk8FzEHu3CAK94TAvmr5+cx8x1cj8QlZkJG+yQEj95OrwjA2DhWMAKVL9ONPpatY/ZJlH9UdmAyeqzGwvZhIwg1NHuhwOIiDAX/CwkS0/AHIse0zJcjAsm25XYbaaAqbWRjLmQt7fZGdLxrdDknqZI5djSt5+OeUQcqNRW6WHyp2qB05uSGKVHXMK1Rvxw7l+OKuvl95+HNjz75iu1oZNa32/nT4+DHlRqsoPglsp0wjj700UJdrPBigvq/c25Qh6ZRjXfjcwKPW0bt1ih7/pxwuvKDUDka8IgcqhUdYCpB1WxuuYiQ84RnS7HG+5iPCCTxtPKtd8nikxUh5SHYDUGNvoaJsw6WYIOp0f3yaW+5anbinrInlceevLYTdq6LiNv92coq0rKeQEW4l8hOwpfGR1lbP/q8pQTHMJ7kS5eBEUuR6pa0lT/SooE8X+mUN3W/rlJIWJd2Hnjn2S+DjCFSHRpxJWYZ9MJIEWq8mkS6nk/pSeqTyiXoXj8F0f0LmWC7S8vTsGsL87zHNHezMsOs36HMx5IchTvgTzlcuL2y07FRZtagSOy+sc0HCR+UmS8HVoxVTpqvIWJHJMUCaKKrcpkkZw== 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:(13230001)(4636009)(40470700004)(46966006)(36840700001)(4326008)(8676002)(83380400001)(70206006)(70586007)(81166007)(40460700003)(2906002)(356005)(336012)(110136005)(36756003)(54906003)(508600001)(6666004)(7696005)(316002)(36860700001)(82310400005)(2616005)(26005)(1076003)(5660300002)(186003)(16526019)(86362001)(8936002)(44832011)(426003)(47076005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 May 2022 14:55:55.8431 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 84e6ef3e-585e-4a3f-94b5-08da31cc056a 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: CO1NAM11FT064.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4296 Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org From: Muralidhara M K GPU Nodes will need to set the EDAC memory type differently than existing systems. A function pointer should be used rather than introduce another branching condition. Prepare for this by adding determine_memory_type() to pvt->ops and set it as needed based on currently supported systems. Use a "umc" prefix for modern systems, since these use Unified Memory Controllers (UMCs). Use a "dct" prefix for newly-defined legacy functions, since these systems use DRAM Controllers (DCTs). Signed-off-by: Muralidhara M K Signed-off-by: Naveen Krishna Chatradhi [Rebased/reworked patch and reworded commit message] Signed-off-by: Yazen Ghannam --- drivers/edac/amd64_edac.c | 16 +++++++--------- drivers/edac/amd64_edac.h | 1 + 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 6e26bbb73f81..a767d8a6bfe8 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -1604,7 +1604,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; @@ -1641,13 +1641,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) @@ -1697,6 +1694,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: @@ -3302,10 +3301,7 @@ static void read_mc_regs(struct amd64_pvt *pvt) pvt->ops->read_base_mask(pvt); - determine_memory_type(pvt); - - if (!pvt->umc) - edac_dbg(1, " DIMM type: %s\n", edac_mem_types[pvt->dram_type]); + pvt->ops->determine_memory_type(pvt); determine_ecc_sym_sz(pvt); } @@ -3763,6 +3759,7 @@ static struct low_ops umc_ops = { .dbam_to_cs = umc_addr_mask_to_cs_size, .prep_chip_selects = umc_prep_chip_selects, .read_base_mask = umc_read_base_mask, + .determine_memory_type = umc_determine_memory_type, }; /* Use Family 16h versions for defaults and adjust as needed below. */ @@ -3772,6 +3769,7 @@ static struct low_ops dct_ops = { .dbam_to_cs = f16_dbam_to_chip_select, .prep_chip_selects = dct_prep_chip_selects, .read_base_mask = dct_read_base_mask, + .determine_memory_type = dct_determine_memory_type, }; static int per_family_init(struct amd64_pvt *pvt) diff --git a/drivers/edac/amd64_edac.h b/drivers/edac/amd64_edac.h index c81cc7f5fc96..da3db0f4f59b 100644 --- a/drivers/edac/amd64_edac.h +++ b/drivers/edac/amd64_edac.h @@ -470,6 +470,7 @@ struct low_ops { unsigned int cs_mode, int cs_mask_nr); void (*prep_chip_selects)(struct amd64_pvt *pvt); void (*read_base_mask)(struct amd64_pvt *pvt); + void (*determine_memory_type)(struct amd64_pvt *pvt); }; int __amd64_read_pci_cfg_dword(struct pci_dev *pdev, int offset, From patchwork Mon May 9 14:55:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 12843739 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 42AC3C433EF for ; Mon, 9 May 2022 14:56:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237824AbiEIPAR (ORCPT ); Mon, 9 May 2022 11:00:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237898AbiEIO7z (ORCPT ); Mon, 9 May 2022 10:59:55 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2073.outbound.protection.outlook.com [40.107.92.73]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C790523BB7C; Mon, 9 May 2022 07:55:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Uo5IiVpMZ+B9WONVWD1CmyLPURWrbu3cQBRoC5YadhLNvWKA79jSPTAc+1OC95RsXrbpb4eI0x8uwX1DCxk3qCRbNMk0W6UZ3ofnnrexbPX+SVkyNG7WEZPjB5o1B51WlPoSgxCnfUm/jAz9ya+vsTD3g11keLAISa/aL8NXpUqjfEZYfxUvu2UV0wKJDwKKiZ2nrJD8QxIhv556GoRdEpnOi0L3w9PTghF+oXasygzzMCiWmj+3qVcSbRx1xSxE0qzIQZOHaeXK/y+yuA7tF3jYcyp+vQN72fM4lIPWO5H34qCgcdWHJI7ttkWu0Zi3u9TOXwNlnSgDf6VVhd1R0A== 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=SeW/jIouWBPC4KDzx4GjWvZi70dmkyPlBUSkqgpSvgA=; b=kpPwBrd47OkXpZzgvb+q0ZgFzPImIGTsFWCjNuK503RktKrnFjio6tOt5praUEdPwa9SIOzbkB4rFHfcMpc6R9Mqj2GGn92uziJZGVILNYTs0ndJ8Rm8LvgruN35OZSEcxyilbj+8m+FFBJN5BuAduN1gg74lmrnw+HJB8S2e/GPr6TheTaoPFUikNO++z3sHO/h3eqO2hoYnOnfF3FYA8zoxAylP+ORmO1RxrkYcrloGCukcS6Q65HKIo7e+tboIAK5IkCYdadP7oD9hFXWlBPXelSj3nM3w//67X3KppwRaksLuL4yG5vPGeeGPz9kU85ZPWfuEgC+kVKfSLLjlw== 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=SeW/jIouWBPC4KDzx4GjWvZi70dmkyPlBUSkqgpSvgA=; b=gHjc8n5sIhEhxOaqp+Aa+OPUpnvWlsHaJl1vSiIgoUnoCR82BgaKm0G6Lym35L/lA35Xsw87S8N+ryzA0rtqAfzy7jT9lZUl6LvBRJDGWMdM6aD3k1zYWwRFlq8JRlzRh6wf0AV6gvFZIg8CPXaycAulyhok+1NvvlAaWuDBHlI= Received: from MW4PR03CA0219.namprd03.prod.outlook.com (2603:10b6:303:b9::14) by DM5PR12MB1692.namprd12.prod.outlook.com (2603:10b6:4:5::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.23; Mon, 9 May 2022 14:55:57 +0000 Received: from CO1NAM11FT012.eop-nam11.prod.protection.outlook.com (2603:10b6:303:b9:cafe::6) by MW4PR03CA0219.outlook.office365.com (2603:10b6:303:b9::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.22 via Frontend Transport; Mon, 9 May 2022 14:55:57 +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; Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT012.mail.protection.outlook.com (10.13.175.192) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5227.15 via Frontend Transport; Mon, 9 May 2022 14:55:57 +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.24; Mon, 9 May 2022 09:55:49 -0500 From: Yazen Ghannam To: , CC: , , , , Yazen Ghannam Subject: [PATCH 09/18] EDAC/amd64: Add get_ecc_sym_sz() into pvt->ops Date: Mon, 9 May 2022 14:55:25 +0000 Message-ID: <20220509145534.44912-10-yazen.ghannam@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509145534.44912-1-yazen.ghannam@amd.com> References: <20220509145534.44912-1-yazen.ghannam@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9b68fd8b-afac-41e0-b017-08da31cc063f X-MS-TrafficTypeDiagnostic: DM5PR12MB1692:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IPrSh9mxuqdlpEa01th0/ComJpxiPIZYYC2ret2xsUlJRGUlzreri9gzhlaFVe803QvrmKtUe30JRIrLMK/mGurf0S4OSJlVGUrHEM8FNLjJLSpdryKZ7YJfarKvcmz2SoNSc8p9T7kVJ+/a+Hv/UkSFW3z8QIclVZ/RamFw55ftysg2z1e/Of700qlA8n8c+MU+01LSu5KvXmC9pWUhFDfn/Eg6bzjkw333Mpy5GwSbXqCMIuNgCpik/zbwB5y3c9pjUrDalgE153q2rdt6OJTNHhcB3nZiHMqC4hLhDqt2czfTxt2HIaD0IuE26Iwg5MS5YmDIUKPv4+I/UZhcJ6fEjSLxHcLxQ/KKysa7BtuVJypT/sHvL/VMLWFkiza57WiebFx1M+J6x+SIZGkt4yOgWVDm0ekOg+XEHzAv/pK4oQDXGNl4a++vJd7roq/o+TVhtQ91f3lAwLv/Y+MIl+W6J/AR7R/WxI1kHDFvjpaOn2BohuTPawhN6MUbIM2zpXWpnCwn2QJgP2mF2Xg5cB8mbJuM+PDGPqgrIIxcbqpwYT96FML5BtUeIJaApjsqq+cfNKsUNPcEDm3hFkBSo7gqKvOVdJ/rEIFNTI5RizbHQpa7Vp0l5Ou6J0GBq/U/o/YLgbXMlFTeQ4sBaareYXwsk5BiWIYhasxa7ZOqPLQjRF1q0TMEk8sVMKFp1oUoINIs9SzAyDoL+NMrFTyXvA== 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:(13230001)(4636009)(46966006)(40470700004)(36840700001)(2616005)(40460700003)(26005)(36860700001)(36756003)(8676002)(4326008)(82310400005)(16526019)(1076003)(47076005)(186003)(426003)(336012)(70206006)(70586007)(110136005)(54906003)(316002)(508600001)(5660300002)(86362001)(6666004)(2906002)(8936002)(7696005)(81166007)(83380400001)(356005)(44832011)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 May 2022 14:55:57.2398 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9b68fd8b-afac-41e0-b017-08da31cc063f 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: CO1NAM11FT012.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1692 Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org From: Muralidhara M K GPU Nodes will need to determine ECC symbol size differently than existing systems. A function pointer should be used rather than introduce another branching condition. Prepare for this by adding get_ecc_sym_sz() to pvt->ops and set it as needed based on currently supported systems. Use a "umc" prefix for modern systems, since these use Unified Memory Controllers (UMCs). Use a "dct" prefix for newly-defined legacy functions, since these systems use DRAM Controllers (DCTs). Signed-off-by: Muralidhara M K Signed-off-by: Naveen Krishna Chatradhi [Rebased/reworked patch and reworded commit message] Signed-off-by: Yazen Ghannam --- drivers/edac/amd64_edac.c | 43 +++++++++++++++++++++++---------------- drivers/edac/amd64_edac.h | 1 + 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index a767d8a6bfe8..2a3205f1205e 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -3169,26 +3169,11 @@ static void free_mc_sibling_devs(struct amd64_pvt *pvt) } } -static void determine_ecc_sym_sz(struct amd64_pvt *pvt) +static void dct_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); @@ -3202,6 +3187,26 @@ static void determine_ecc_sym_sz(struct amd64_pvt *pvt) } } +static void umc_determine_ecc_sym_sz(struct amd64_pvt *pvt) +{ + u8 i; + + pvt->ecc_sym_sz = 4; + + 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; + } + } + } +} + /* * Retrieve the hardware registers of the memory controller. */ @@ -3303,7 +3308,7 @@ static void read_mc_regs(struct amd64_pvt *pvt) pvt->ops->determine_memory_type(pvt); - determine_ecc_sym_sz(pvt); + pvt->ops->determine_ecc_sym_sz(pvt); } /* @@ -3760,6 +3765,7 @@ static struct low_ops umc_ops = { .prep_chip_selects = umc_prep_chip_selects, .read_base_mask = umc_read_base_mask, .determine_memory_type = umc_determine_memory_type, + .determine_ecc_sym_sz = umc_determine_ecc_sym_sz, }; /* Use Family 16h versions for defaults and adjust as needed below. */ @@ -3770,6 +3776,7 @@ static struct low_ops dct_ops = { .prep_chip_selects = dct_prep_chip_selects, .read_base_mask = dct_read_base_mask, .determine_memory_type = dct_determine_memory_type, + .determine_ecc_sym_sz = dct_determine_ecc_sym_sz, }; static int per_family_init(struct amd64_pvt *pvt) diff --git a/drivers/edac/amd64_edac.h b/drivers/edac/amd64_edac.h index da3db0f4f59b..5e9ff6ea7ebc 100644 --- a/drivers/edac/amd64_edac.h +++ b/drivers/edac/amd64_edac.h @@ -471,6 +471,7 @@ struct low_ops { void (*prep_chip_selects)(struct amd64_pvt *pvt); void (*read_base_mask)(struct amd64_pvt *pvt); void (*determine_memory_type)(struct amd64_pvt *pvt); + void (*determine_ecc_sym_sz)(struct amd64_pvt *pvt); }; int __amd64_read_pci_cfg_dword(struct pci_dev *pdev, int offset, From patchwork Mon May 9 14:55:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 12843729 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 6A8CEC433F5 for ; Mon, 9 May 2022 14:56:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237936AbiEIPAB (ORCPT ); Mon, 9 May 2022 11:00:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237894AbiEIO7y (ORCPT ); Mon, 9 May 2022 10:59:54 -0400 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam08on2045.outbound.protection.outlook.com [40.107.102.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E035B286F7; Mon, 9 May 2022 07:55:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SKqdYVlJZXGYJeJ7TNT6waB8v3e2VEVpCoRqSew+u2C1TH2hXjKHx7lqT5hYMEwW4GpQCaCz8WcH0Thw7WWtdo0E0K8Li7SEUxT5v5oVGH0ouULzVZ4hRjWqQFxW6LhWfwP4lv5In2dFrrirIgidWhyaogHs0lezEk8p9OkuKOcw0VvJI+oWTSDuFYpb7NwmGPYNa0Wfv88Tc/G9Zba4DqC+yZCFcO4kPQRLd6Z/mL/bdCTQPAweiiCfUlkKikXnZT9STjoRxZ0XRm5GTy7kWN5kSoRDNxZp3bqVqfc3vCj3VzcGomAOAFgSXVsRyMwlimqGQo+quD59GE7tUMtC1Q== 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=YebxQgAHXOBxSeIMDxtNq1N4eqMyZybm+4tR4mO5C68=; b=HJlcJ3dyxUQLDCFAJpzh0+c5hwhlN/n3MN5KJiwJg/IyRZ3gt5yD8r6abHtAli4kL6ayumEFYb3yf6kSddGaLch5ESMn5MxF1dGhCesVTexWkG4frPmzYLkNhPYr5My3pBHJMUP3xxJ82TOuHKQHQF4XPV3ZqPo76UMnvqIDMP5hriEeq5lLTUjOmBzXFc2Rw6KZ73mBXmCXrLT9T8RXpg2LrU2AoC7y2IfJH3oqR9IHIJg35o7s9KjtkRboS4qfHtRI+5oBf4ZYLYBMoGsE4H8mn9K7iYr0jH3uJZYNGp/ocVx07NmyHQ5CNireiVL2in+V2x/EEeXZkOuW6E50Ww== 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=YebxQgAHXOBxSeIMDxtNq1N4eqMyZybm+4tR4mO5C68=; b=GmQJp8ybbE2DLvH1dY51W/hmbDgQZKB0+262VLgPCoZT/RwCU0iNIEU6c7vsNrwfJYZNGKYNx2R7lkjQGWQ9doFIuuOO7yEsGJQJDEsgPDk7ovosR0xa2AhrCeiqMUGlDDtiOX60VJIwS2MK3hASkkjw3qB/EbRWY6bdfMHfjQY= Received: from MW4PR03CA0008.namprd03.prod.outlook.com (2603:10b6:303:8f::13) by DM6PR12MB2890.namprd12.prod.outlook.com (2603:10b6:5:15e::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.21; Mon, 9 May 2022 14:55:56 +0000 Received: from CO1NAM11FT009.eop-nam11.prod.protection.outlook.com (2603:10b6:303:8f:cafe::61) by MW4PR03CA0008.outlook.office365.com (2603:10b6:303:8f::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.21 via Frontend Transport; Mon, 9 May 2022 14:55:56 +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; Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT009.mail.protection.outlook.com (10.13.175.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5227.15 via Frontend Transport; Mon, 9 May 2022 14:55:56 +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.24; Mon, 9 May 2022 09:55:49 -0500 From: Yazen Ghannam To: , CC: , , , , Yazen Ghannam Subject: [PATCH 10/18] EDAC/amd64: Add read_mc_regs() into pvt->ops Date: Mon, 9 May 2022 14:55:26 +0000 Message-ID: <20220509145534.44912-11-yazen.ghannam@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509145534.44912-1-yazen.ghannam@amd.com> References: <20220509145534.44912-1-yazen.ghannam@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 81efa8d4-8866-47c4-2039-08da31cc05de X-MS-TrafficTypeDiagnostic: DM6PR12MB2890:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ASB3G/UEmBaZfS7pf8HJ7GQHiIxlRjqKOG9J8isu9YZtomdvmJ33XUX4gx6XyHlXlhjnvtL94zdDM/9Gb2+/2575S3R2k0eCYDuSV2rnM3OBOzD8Uzb3/dR3hM5CPag9ze0lmu+4nXOBr8b/6C+NLXDbxcBdJcAGItsIJ+QobwvPPHCzBLleTusn00DltThx//Yi1nDaXlrBcizEt9KBJ0W0usw6SrzWlS5uMpZVW7SD9EziB1NSOwO1dXM/k8xa0TQCXA2kgqRUY84vTy3UGLkkMUl4WSR/nkSy21sbnIDmKxdLtFOa+7+n0+uJH0h6Cf49E306kjn0m4fmF4A2puslwXR08xea8tDng4ij0QyNPp4qWTmc0K1bivhXKq274OxFyhfVHHS6EtzXeqZcb7jeLdXV0AGJSGdhCgF+Xeq0/1rjEXB6wHAfa5gVCx36acZJ9IVgbo3rT9606KbpC/D8fyTEPIUhbwzTlaHybG1CKwzWRQoYJnnvYhqXzyWPJyo05O0auuAHrlq+YbNQqHr8j86Uqa5ikj7ymA0zWC13EUA4bnpoEeW/oS6n9tw/TXw1NJ+BjihZwq9yu/lSlSrA2/vEpS1jH1ed1xGnAROoYmjfIcuxh7KtxehfexwSHZOsHejEhaerv2SZDRREU+iRYboUGXJ5eb10fjxlpxULT4Rq+5E29V5StdwsT58JdZgWKDqh3mUyqbTxl5hDYw== 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:(13230001)(4636009)(40470700004)(36840700001)(46966006)(110136005)(54906003)(508600001)(7696005)(70586007)(86362001)(82310400005)(356005)(316002)(6666004)(81166007)(2906002)(36756003)(16526019)(336012)(70206006)(186003)(47076005)(426003)(40460700003)(26005)(5660300002)(83380400001)(2616005)(1076003)(8676002)(4326008)(44832011)(36860700001)(8936002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 May 2022 14:55:56.5848 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 81efa8d4-8866-47c4-2039-08da31cc05de 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: CO1NAM11FT009.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB2890 Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org From: Muralidhara M K GPU Nodes will read a different set of memory controller values compared than existing systems. A function pointer should be used rather than introduce another branching condition. Prepare for this by adding read_mc_regs() to pvt->ops and set it as needed based on currently supported systems. Reading the TOM/TOM2 registers is preserved in the legacy function and removed for the modern function. The values don't seem useful for the EDAC module on modern systems. But they are kept for legacy systems in case there was a need for them. Use a "umc" prefix for modern systems, since these use Unified Memory Controllers (UMCs). Use a "dct" prefix for newly-defined legacy functions, since these systems use DRAM Controllers (DCTs). Signed-off-by: Muralidhara M K Signed-off-by: Naveen Krishna Chatradhi [Rebased/reworked patch and reworded commit message] Signed-off-by: Yazen Ghannam --- drivers/edac/amd64_edac.c | 31 +++++++++++++------------------ drivers/edac/amd64_edac.h | 1 + 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 2a3205f1205e..1bf1660fe8f3 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -3210,7 +3210,7 @@ static void umc_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; @@ -3234,7 +3234,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; @@ -3255,12 +3255,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); @@ -3300,15 +3294,6 @@ static void read_mc_regs(struct amd64_pvt *pvt) amd64_read_dct_pci_cfg(pvt, 1, DCLR0, &pvt->dclr1); amd64_read_dct_pci_cfg(pvt, 1, DCHR0, &pvt->dchr1); } - -skip: - pvt->ops->prep_chip_selects(pvt); - - pvt->ops->read_base_mask(pvt); - - pvt->ops->determine_memory_type(pvt); - - pvt->ops->determine_ecc_sym_sz(pvt); } /* @@ -3766,6 +3751,7 @@ static struct low_ops umc_ops = { .read_base_mask = umc_read_base_mask, .determine_memory_type = umc_determine_memory_type, .determine_ecc_sym_sz = umc_determine_ecc_sym_sz, + .read_mc_regs = umc_read_mc_regs, }; /* Use Family 16h versions for defaults and adjust as needed below. */ @@ -3777,6 +3763,7 @@ static struct low_ops dct_ops = { .read_base_mask = dct_read_base_mask, .determine_memory_type = dct_determine_memory_type, .determine_ecc_sym_sz = dct_determine_ecc_sym_sz, + .read_mc_regs = dct_read_mc_regs, }; static int per_family_init(struct amd64_pvt *pvt) @@ -3938,7 +3925,15 @@ static int hw_info_get(struct amd64_pvt *pvt) if (ret) return ret; - read_mc_regs(pvt); + pvt->ops->read_mc_regs(pvt); + + pvt->ops->prep_chip_selects(pvt); + + pvt->ops->read_base_mask(pvt); + + pvt->ops->determine_memory_type(pvt); + + pvt->ops->determine_ecc_sym_sz(pvt); return 0; } diff --git a/drivers/edac/amd64_edac.h b/drivers/edac/amd64_edac.h index 5e9ff6ea7ebc..25d0dcc5c480 100644 --- a/drivers/edac/amd64_edac.h +++ b/drivers/edac/amd64_edac.h @@ -472,6 +472,7 @@ struct low_ops { void (*read_base_mask)(struct amd64_pvt *pvt); void (*determine_memory_type)(struct amd64_pvt *pvt); void (*determine_ecc_sym_sz)(struct amd64_pvt *pvt); + void (*read_mc_regs)(struct amd64_pvt *pvt); }; int __amd64_read_pci_cfg_dword(struct pci_dev *pdev, int offset, From patchwork Mon May 9 14:55:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 12843731 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 A9824C433FE for ; Mon, 9 May 2022 14:56:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237941AbiEIPAE (ORCPT ); Mon, 9 May 2022 11:00:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237895AbiEIO7z (ORCPT ); Mon, 9 May 2022 10:59:55 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2073.outbound.protection.outlook.com [40.107.93.73]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2566526A715; Mon, 9 May 2022 07:55:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VYmzeKxiAAA5EXbq6RwfFuDmsJvDaIf2e2C41Dk9nZxEwQpHowLju8AmHC3sN9WvTp7P6wqfIVKzKM09TSr46d/eLX8CDDEoadAbHReN3MnwYqNbY144oXGJ+cTztLBCLDd0LXDY+mNgS+cRvVeBSrglMYirKJXemN0/SexP1qbn2SwfFBXLTmoaSj7TwvhdEsIrkDpOh0/UtJH2pQ/uzvG8U2FkPriR0jYrjtCLFZo86GebKNewXqAFxXG3UbWQSU82vQkAlZbA8yQoCgZYPyYyb/fL0wmo/kIa8/c5bX3Tuuz9dJGTVYUNwyAR9sh3q+mnB+UXkFPFDHKVequLlQ== 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=DF5dL7VQPwYxcVFH1Wz4ttn9SqPOZc0RihBi9oP5638=; b=cFRSEn4aitmZl8mt8eKhkMeu7uZBX56jwCR4iusi1pX/RSxjDdDbuUKzGx20al54SpFqRL1yHSiHdxg3SQrT6KL8+70sP9U0AEZ4etTTown58a1qahTr0RIRlELXK94nNDiuiFCdrhTI37VW+2ZrDydont7En3U1c2F07KuA2nk66lq20n3WIyHDZU2msmDDXRk0V7xy36GxT/T/BAn2SQWtOriABcp9XqPKkDzWJWdw2IqSd2SO8TCKN+RP/P7NXW4LPnCn1zyhQiUXqDwxC2eNNSDfv3GTOeuSDPb8gj4kS4jKMgvZOkS12j8xtkjtINftyi2/91QiaasUnwntBA== 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=DF5dL7VQPwYxcVFH1Wz4ttn9SqPOZc0RihBi9oP5638=; b=ZOQWBaOMxiPGbqr5qUE9rq0M8QEmrAeM+d++KMLafYyKJZIzCuLm5mrDew+5hBXLt1gHb7jeO9Iy7dKV4NsAqLHu5aXPumRZ/Cf5uMz8d5exJ/75LQg/liX3P9KIF6RpZfQ6o1D4e7L3YT2567JLWn/dFDeB1x1BsOl+8d9odNA= Received: from MW4PR03CA0302.namprd03.prod.outlook.com (2603:10b6:303:dd::7) by DM5PR12MB4663.namprd12.prod.outlook.com (2603:10b6:4:a9::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.22; Mon, 9 May 2022 14:55:57 +0000 Received: from CO1NAM11FT064.eop-nam11.prod.protection.outlook.com (2603:10b6:303:dd:cafe::6e) by MW4PR03CA0302.outlook.office365.com (2603:10b6:303:dd::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.20 via Frontend Transport; Mon, 9 May 2022 14:55:57 +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; Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT064.mail.protection.outlook.com (10.13.175.77) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5227.15 via Frontend Transport; Mon, 9 May 2022 14:55:56 +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.24; Mon, 9 May 2022 09:55:50 -0500 From: Yazen Ghannam To: , CC: , , , , Yazen Ghannam Subject: [PATCH 11/18] EDAC/amd64: Add ecc_enabled() into pvt->ops Date: Mon, 9 May 2022 14:55:27 +0000 Message-ID: <20220509145534.44912-12-yazen.ghannam@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509145534.44912-1-yazen.ghannam@amd.com> References: <20220509145534.44912-1-yazen.ghannam@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fa444070-db9e-49f9-4f9b-08da31cc060a X-MS-TrafficTypeDiagnostic: DM5PR12MB4663:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vG7Ec8C8EnBh4NE9lsq4f1bdPpGqiRXJGbNCV106naOIao1d0hM2ypD6A+xhFuvgz+jn38QbfqEQ+yMK/dqG54TEG/JPWcaC+Dt+lTTp1z6z9Vgchuc9UDoAPTTEy8Jbx2nriQZsXgaccYneuGm4/OrzDcI1kt9rKSBWq9yPSEDCw2WpQQLBp96T1EliZiQfyPkqv4BQrJ4XPP8a0C+sUtgF7ZpmNQ9YcPA4BLCX3LliIPYSG9RX0iY89F0JZOuW5unLakchQ9r+cBxuQf1VgUg/hB9/4yn5Jih7NQOuO9MmtLeaO1lfIRf8011j1kn8D5N0ho/3nTUsoqmoZDKfkil/dnyE/CA3T5zbNzHwlX4aQe6EPs2Jj888E0w4pWgG+PmQhYJdJCFDvmO2YO5Kb+iFxGLjh9jl6mUoRmlhVKOoGZ/z7omaaIyscA+atToAOuB3dg2VB1L9NvyVq1mUb1I1jcASB8X/xvHaKPuRgrVAuZTdnJ8sibTIH6vjBGMtQC/W+EijZzZNRAQI4wLSf1Yv7/b717vBiGNGiTl6RXtB/6kieRP7K9gFcJ8o2s/H0jjo4gW605Rt/pRHh6Lq2VCygnzo5N3ymFSTfaEB+IOqEuaMmDDnrvPg1LI9F8Vrh9uYV7GqjqSgcDgjTYY+kCSih6MU7UrV703Y9Aa4OjJAGgty0ocmdm5Dwlx/V3UcbAXn7U1DPbzKocpd8M/fuQ== 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:(13230001)(4636009)(46966006)(40470700004)(36840700001)(336012)(36860700001)(508600001)(426003)(47076005)(2616005)(40460700003)(316002)(2906002)(1076003)(16526019)(186003)(6666004)(7696005)(86362001)(5660300002)(26005)(83380400001)(44832011)(356005)(36756003)(82310400005)(81166007)(54906003)(70586007)(70206006)(4326008)(8676002)(8936002)(110136005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 May 2022 14:55:56.8900 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fa444070-db9e-49f9-4f9b-08da31cc060a 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: CO1NAM11FT064.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB4663 Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org From: Muralidhara M K GPU Nodes will have different criteria for checking if ECC is enabled. A function pointer should be used rather than introduce another branching condition. Prepare for this by adding ecc_enabled() to pvt->ops and set it as needed based on currently supported systems. Use a "umc" prefix for modern systems, since these use Unified Memory Controllers (UMCs). Use a "dct" prefix for newly-defined legacy functions, since these systems use DRAM Controllers (DCTs). Signed-off-by: Muralidhara M K Signed-off-by: Naveen Krishna Chatradhi [Rebased/reworked patch and reworded commit message] Signed-off-by: Yazen Ghannam --- 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 1bf1660fe8f3..136f2454a502 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -3634,52 +3634,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; @@ -3752,6 +3759,7 @@ static struct low_ops umc_ops = { .determine_memory_type = umc_determine_memory_type, .determine_ecc_sym_sz = umc_determine_ecc_sym_sz, .read_mc_regs = umc_read_mc_regs, + .ecc_enabled = umc_ecc_enabled, }; /* Use Family 16h versions for defaults and adjust as needed below. */ @@ -3764,6 +3772,7 @@ static struct low_ops dct_ops = { .determine_memory_type = dct_determine_memory_type, .determine_ecc_sym_sz = dct_determine_ecc_sym_sz, .read_mc_regs = dct_read_mc_regs, + .ecc_enabled = dct_ecc_enabled, }; static int per_family_init(struct amd64_pvt *pvt) @@ -4045,7 +4054,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 25d0dcc5c480..99b6ffa21ba5 100644 --- a/drivers/edac/amd64_edac.h +++ b/drivers/edac/amd64_edac.h @@ -473,6 +473,7 @@ struct low_ops { void (*determine_memory_type)(struct amd64_pvt *pvt); void (*determine_ecc_sym_sz)(struct amd64_pvt *pvt); void (*read_mc_regs)(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 Mon May 9 14:55:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 12843732 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 BEEEAC433F5 for ; Mon, 9 May 2022 14:56:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237864AbiEIPAF (ORCPT ); Mon, 9 May 2022 11:00:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237897AbiEIO7z (ORCPT ); Mon, 9 May 2022 10:59:55 -0400 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam07on2041.outbound.protection.outlook.com [40.107.212.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B565F1FD1CF; Mon, 9 May 2022 07:55:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=niiGLknwOx0YVigjb+eeJgbsxBmbf+pStU/IrcJYY2gQSV8s+Zz8tZelVFXRzC0WP28sXkbbWhiwTeDAwirJZ2cpVv2fSgoiimoivNp/anIW+EJGOwYTpSUmgwpdnSsxSY00X2V2t8HPI3DzGo6YkAaQlUNkvDSyzWCWj2T70x+48dkVF8l0xDw1Ioap+8JSnXaFo8/JQysdVc04X2GOAYSItFY5yzDbg24OzKWm4J9PduCzd8pjEzD5pHw/SsLhVLIwQwQcAeTP+mTWesbfWubkgV/MToZ+KD7g4URdy6uupGuwozoit/3Xp8uIhmvO6IdlJ1nSWJ4RImJ+LXT7uw== 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=QZzpEe7JE7ZHMd3zTf9mjvVpGLyBQqbSi8m7EoLSh0c=; b=CQKIX64Dv7iCH7Df7JmAe38xZCSYDHcA83lx0+fYPhV+CywrHEVwYNmsKCLm//Jf7ZXwvECps8YHQHVdcz+einGMEyVFMgEXH63W9e7s57EooC4+5NWX7z8wVPuiEFPz17/cBP83ntnhS3NxK1WNLVvEKnXBV8K0ZAP90LRo4/ZyG0XMjuxHFnqqx2Mf9x6K6UeuXKdu+Bl8QnSS/CBmU0AHoZIGd7r7In0QnfZ46UEp8YRHB8QZbAyLQ8zU/OXFkOyNno7xUn2EsukZBveL5rnCs/df5GXVZk2Hx+AQspEnuU8HBuGgHG6tLqEe1LJCortMyn32J+BPVn9vyU3OkA== 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=QZzpEe7JE7ZHMd3zTf9mjvVpGLyBQqbSi8m7EoLSh0c=; b=H27G26sbJiGn73qtvFwrSNHn8di6VmPmASla6L/5Emq/5xX8JPIPLj1QapgJaVfLYG0m8LxRWgUU7LDXt621KO5mv8Sx9KhU8q8fO1PUtlyuhuRJuOAlmUhd5c9f0ktg9TwNTkdqDYWdW9qcTULYdBplx8Rm6ES9bRHp1EIzMDE= Received: from MW4PR03CA0011.namprd03.prod.outlook.com (2603:10b6:303:8f::16) by CY4PR12MB1910.namprd12.prod.outlook.com (2603:10b6:903:128::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.23; Mon, 9 May 2022 14:55:57 +0000 Received: from CO1NAM11FT009.eop-nam11.prod.protection.outlook.com (2603:10b6:303:8f:cafe::ec) by MW4PR03CA0011.outlook.office365.com (2603:10b6:303:8f::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.22 via Frontend Transport; Mon, 9 May 2022 14:55:57 +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; Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT009.mail.protection.outlook.com (10.13.175.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5227.15 via Frontend Transport; Mon, 9 May 2022 14:55:57 +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.24; Mon, 9 May 2022 09:55:50 -0500 From: Yazen Ghannam To: , CC: , , , , Yazen Ghannam Subject: [PATCH 12/18] EDAC/amd64: Add determine_edac_cap() into pvt->ops Date: Mon, 9 May 2022 14:55:28 +0000 Message-ID: <20220509145534.44912-13-yazen.ghannam@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509145534.44912-1-yazen.ghannam@amd.com> References: <20220509145534.44912-1-yazen.ghannam@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ef5abe70-2572-4008-a370-08da31cc0644 X-MS-TrafficTypeDiagnostic: CY4PR12MB1910:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Bi1Hdu3iPuk9U+1CGd59O9xwLwhMQwOjHAJulgXwaivhFDDqFcAPE4Pf9FGNjvd/1T+idoOygxkiXDnUsFJfGPR9Vkops4W2R6zNpZyxr5asR7UnkBKaRO8HmTdmYf7DhAMDUy9ZiGJZOACpEOis2TS9qQ2luxey0kWnxUyNP4noVoGEEQFF141bwdxVfyXsEEBF8dE43tmoaolrg9fvoYHW+SbRGN74Lo58Y3ZSHLVv7i9AvpubruuewOlMDZsADuM6U5ES7Qg3Gh30zQnRUVrSou3isFYPQL4J2X7PIoPSNQ4iPm1taTdQe69vM8j83ZmpFG7DR0BFdfRlcPvOhUKJ63Cbp6KAty8GczCVhs6otV36bMqAHiRnhuCSbplyfAX5zhtImQs377n+jGuUIguz4CIafUjsq7tDqt/6Aa0IfPtSY9TMF4zFzz8phPW7TQU+NgqwSmdF/1GOlVVrtAwkhp+BPBG6ITL/DqUV4+HnBWPAYvM4YmX+b4iQlmV/C2qp/Pij692YoaL7e235AyxBjPpzzFkNCDz/AdJu+WTQkJcr579q5px1HmB6dfKOQB8EQco3ajQtjvxGK2046OQxRT1VsYFU1gxHe+WrmTzCB+2lMtP9H3zMiadSujeAFPTVGFGLCpH4uB7KuZZ9sQJw8pIxHPrLYYzVvPx34LIPpj1GzTPez+1r2Unh90/yGz89TRh5EEVjhbREluPzZg== 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:(13230001)(4636009)(36840700001)(46966006)(40470700004)(16526019)(8676002)(4326008)(8936002)(86362001)(70206006)(70586007)(82310400005)(186003)(36756003)(426003)(36860700001)(5660300002)(83380400001)(316002)(508600001)(54906003)(336012)(47076005)(110136005)(44832011)(6666004)(2906002)(81166007)(40460700003)(356005)(7696005)(2616005)(26005)(1076003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 May 2022 14:55:57.2878 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ef5abe70-2572-4008-a370-08da31cc0644 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: CO1NAM11FT009.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1910 Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org From: Muralidhara M K GPU Nodes will have different criteria for checking the EDAC capabilities of a controller. A function pointer should be used rather than introduce another branching condition. Prepare for this by adding determine_edac_cap() to pvt->ops and set it as needed based on currently supported systems. Use a "umc" prefix for modern systems, since these use Unified Memory Controllers (UMCs). Use a "dct" prefix for newly-defined legacy functions, since these systems use DRAM Controllers (DCTs). Signed-off-by: Muralidhara M K Signed-off-by: Naveen Krishna Chatradhi [Rebased/reworked patch and reworded commit message] Signed-off-by: Yazen Ghannam --- drivers/edac/amd64_edac.c | 30 ++++++++++++++++++------------ drivers/edac/amd64_edac.h | 1 + 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 136f2454a502..0bc9a3846773 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -1261,13 +1261,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)) @@ -1282,14 +1294,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; } @@ -3740,7 +3744,7 @@ static void setup_mci_misc_attrs(struct mem_ctl_info *mci) mci->edac_ctl_cap |= EDAC_FLAG_S4ECD4ED; } - mci->edac_cap = determine_edac_cap(pvt); + mci->edac_cap = pvt->ops->determine_edac_cap(pvt); mci->mod_name = EDAC_MOD_STR; mci->ctl_name = pvt->ctl_name; mci->dev_name = pci_name(pvt->F3); @@ -3760,6 +3764,7 @@ static struct low_ops umc_ops = { .determine_ecc_sym_sz = umc_determine_ecc_sym_sz, .read_mc_regs = umc_read_mc_regs, .ecc_enabled = umc_ecc_enabled, + .determine_edac_cap = umc_determine_edac_cap, }; /* Use Family 16h versions for defaults and adjust as needed below. */ @@ -3773,6 +3778,7 @@ static struct low_ops dct_ops = { .determine_ecc_sym_sz = dct_determine_ecc_sym_sz, .read_mc_regs = dct_read_mc_regs, .ecc_enabled = dct_ecc_enabled, + .determine_edac_cap = dct_determine_edac_cap, }; static int per_family_init(struct amd64_pvt *pvt) diff --git a/drivers/edac/amd64_edac.h b/drivers/edac/amd64_edac.h index 99b6ffa21ba5..bfe48492a0ba 100644 --- a/drivers/edac/amd64_edac.h +++ b/drivers/edac/amd64_edac.h @@ -474,6 +474,7 @@ struct low_ops { void (*determine_ecc_sym_sz)(struct amd64_pvt *pvt); void (*read_mc_regs)(struct amd64_pvt *pvt); bool (*ecc_enabled)(struct amd64_pvt *pvt); + unsigned long (*determine_edac_cap)(struct amd64_pvt *pvt); }; int __amd64_read_pci_cfg_dword(struct pci_dev *pdev, int offset, From patchwork Mon May 9 14:55:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 12843733 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 0CB25C433EF for ; Mon, 9 May 2022 14:56:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237774AbiEIPAH (ORCPT ); Mon, 9 May 2022 11:00:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237922AbiEIPAA (ORCPT ); Mon, 9 May 2022 11:00:00 -0400 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam08on2087.outbound.protection.outlook.com [40.107.100.87]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64C7D26A73F; Mon, 9 May 2022 07:56:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Yvtf1H0ezYMqjyQuKPJCAFZJx5/GGbzqiaYDtc1oGRSvFRwKBTC6yxu6SodmNNH7Erf/3BEAOVA/LrjS9BXM1BZ10/RE9D1lchHxk1PCAcFCiZPZrmmfTqj9EeipTMHh9sDDsTO1ur9Ih4izMh3ug8I+85ejPuvOA/Nh3eUYgvqqWc60xg/coLuzxGcuCjDz0d8kFfpGbVRG624D9oMDVzKjG1I5kas9IA5I1pQi+OFUUq62rZVEpSGNOP6P3f/poe37mAdYBSm71p96iHAq2U6u9PiNNb++KH2+kvy/MoQHWRjEgvD52UYA3Fjol2EDxrSgTUt18rrtaUO0wQhI8g== 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=HlhqmtsNBlT3tPtZdfyxOgpgqWHeKNQvXc6wS0JeOvw=; b=WuJhr1wdkJlFMj7SEXyR83e0lb+2SOYOvARQwUH8dHr2uKsmxt7dqpYuKxA9AIVF+ywwhGlG2DbkNUD+PNHRnnYdx18poT9ADCF8Cd41VLvQdRmMWLyhR2/3oQc6T0aUMkZ09VW2ukC464Wia9c2/RvTIg1WewAN323VBVLcqjDw+S5EIAaZRO8MjRqsQIwu3fJWArAlezAtvyo4ibj3kopOausOcjm4KKZUxzbMLeUmgwiZoQUDuVNlIBK1cm0nlJECCX/EzwCOfXuSUfmJzbZr1cic4p0L3+WxcSzxc80Q0SLqxbGDAUtbdrcIb1yUGwllp1jCyuvEQIToThgVMg== 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=HlhqmtsNBlT3tPtZdfyxOgpgqWHeKNQvXc6wS0JeOvw=; b=l0+PIgTzslS+7/lJ/zcVKDOJxM+Eaz4Yh3fPci46d2bX8d2oyADYfiXz+I6j6c0qyRCSf2jOHH/Q+McoRjwBHlvop7MQUj8UnCBuvfYI6t/gZ9amPrumqXzU6AdovRlSGzN2p6aL0q2HGo9Govx7Ob+gI4khuskikz73E9X+0Ys= Received: from MW4PR03CA0306.namprd03.prod.outlook.com (2603:10b6:303:dd::11) by BN6PR12MB1409.namprd12.prod.outlook.com (2603:10b6:404:1e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.18; Mon, 9 May 2022 14:55:58 +0000 Received: from CO1NAM11FT064.eop-nam11.prod.protection.outlook.com (2603:10b6:303:dd:cafe::6) by MW4PR03CA0306.outlook.office365.com (2603:10b6:303:dd::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.20 via Frontend Transport; Mon, 9 May 2022 14:55:57 +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; Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT064.mail.protection.outlook.com (10.13.175.77) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5227.15 via Frontend Transport; Mon, 9 May 2022 14:55:57 +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.24; Mon, 9 May 2022 09:55:50 -0500 From: Yazen Ghannam To: , CC: , , , , Yazen Ghannam Subject: [PATCH 13/18] EDAC/amd64: Add determine_edac_ctl_cap() into pvt->ops Date: Mon, 9 May 2022 14:55:29 +0000 Message-ID: <20220509145534.44912-14-yazen.ghannam@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509145534.44912-1-yazen.ghannam@amd.com> References: <20220509145534.44912-1-yazen.ghannam@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e54ee8e9-0352-4282-47ba-08da31cc0686 X-MS-TrafficTypeDiagnostic: BN6PR12MB1409:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 74dcrw/GEWcBid7bwDUycjNM8/NU/FZuzB4FJuB6kQ0iiPUN9jA2peVbpHD7mU+DS0JTtBBfyCj0KHi+NJsft/NN8/QVIf/p8EE3i/H60gCcT1WCVaiCILwNJ9BOuNYCY+u2kt6Yd5Rc7bJ7nsuPs6m/3DjtkwrxXJ3e8sajGC4AGY18CoR5tqJNDjR6MSt+kEQs3P6pTO2Tx2uaqOWkSZIXGi7spP07gVdPjP/uFypr8lGg/bSYsieAxxUthjiEhadEc4nM8+XmmePO5tTEKkkIHD8yRikssBhZF1VWI0ycCz3w6HMeEmQu2S/+QzNOGhPGnoP5MIBqJkOid2D0XdRi+ABv50H2r6tMDLmKsUwO/vFzT1GmF9u25kAoMJmE1Bb3Annc7sPeuX3KHNQesIsGt95OO2KVP99Mq+luyqwPlJzZ+UQKviZFlc6MevZJXaKwfPv4cnYaHRlFC4SMhHJ+LqKj4zlDVSNbfKBcz67PurPrvA+hRLhT9rlezXGPjtApDVwNKh8LZ5bzVwrBE5qhcb7odB+a5gOgpEamhit1k6V9l/VOBxzg7LxFVuj/0U8zhomPoUdpM3JQ3MviBwNbh0sUNEC+tKzJEta+jFQ7QDb8WgL84uMh2rglxlPOii9psWkxeCY7ZdjOOx4Pyw/TS4yDLOv88qcFigQPVj1EIjKt7dAQ0xTtJEsxIMsn7PMsyPlwQI8nFlsLiwxChA== 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:(13230001)(4636009)(46966006)(40470700004)(36840700001)(40460700003)(7696005)(26005)(44832011)(6666004)(83380400001)(36756003)(81166007)(5660300002)(1076003)(2616005)(186003)(336012)(82310400005)(47076005)(2906002)(426003)(8676002)(508600001)(8936002)(316002)(356005)(70206006)(70586007)(86362001)(4326008)(54906003)(36860700001)(110136005)(16526019)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 May 2022 14:55:57.7024 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e54ee8e9-0352-4282-47ba-08da31cc0686 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: CO1NAM11FT064.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1409 Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org From: Muralidhara M K GPU Nodes will have different criteria for checking the EDAC capabilities of a controller. A function pointer should be used rather than introduce another branching condition. Prepare for this by adding determine_edac_ctl_cap() to pvt->ops and set it as needed based on currently supported systems. Use a "umc" prefix for modern systems, since these use Unified Memory Controllers (UMCs). Use a "dct" prefix for newly-defined legacy functions, since these systems use DRAM Controllers (DCTs). Signed-off-by: Muralidhara M K Signed-off-by: Naveen Krishna Chatradhi [Rebased/reworked patch and reworded commit message] Signed-off-by: Yazen Ghannam --- drivers/edac/amd64_edac.c | 24 ++++++++++++++---------- drivers/edac/amd64_edac.h | 1 + 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 0bc9a3846773..b99eaa73131e 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -3697,7 +3697,17 @@ 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) +dct_determine_edac_ctl_cap(struct mem_ctl_info *mci, struct amd64_pvt *pvt) +{ + if (pvt->nbcap & NBCAP_SECDED) + mci->edac_ctl_cap |= EDAC_FLAG_SECDED; + + if (pvt->nbcap & NBCAP_CHIPKILL) + mci->edac_ctl_cap |= EDAC_FLAG_S4ECD4ED; +} + +static inline void +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; @@ -3734,15 +3744,7 @@ static void setup_mci_misc_attrs(struct mem_ctl_info *mci) 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_CHIPKILL) - mci->edac_ctl_cap |= EDAC_FLAG_S4ECD4ED; - } + pvt->ops->determine_edac_ctl_cap(mci, pvt); mci->edac_cap = pvt->ops->determine_edac_cap(pvt); mci->mod_name = EDAC_MOD_STR; @@ -3765,6 +3767,7 @@ static struct low_ops umc_ops = { .read_mc_regs = umc_read_mc_regs, .ecc_enabled = umc_ecc_enabled, .determine_edac_cap = umc_determine_edac_cap, + .determine_edac_ctl_cap = umc_determine_edac_ctl_cap, }; /* Use Family 16h versions for defaults and adjust as needed below. */ @@ -3779,6 +3782,7 @@ static struct low_ops dct_ops = { .read_mc_regs = dct_read_mc_regs, .ecc_enabled = dct_ecc_enabled, .determine_edac_cap = dct_determine_edac_cap, + .determine_edac_ctl_cap = dct_determine_edac_ctl_cap, }; static int per_family_init(struct amd64_pvt *pvt) diff --git a/drivers/edac/amd64_edac.h b/drivers/edac/amd64_edac.h index bfe48492a0ba..15521adec9b5 100644 --- a/drivers/edac/amd64_edac.h +++ b/drivers/edac/amd64_edac.h @@ -475,6 +475,7 @@ struct low_ops { void (*read_mc_regs)(struct amd64_pvt *pvt); bool (*ecc_enabled)(struct amd64_pvt *pvt); unsigned long (*determine_edac_cap)(struct amd64_pvt *pvt); + void (*determine_edac_ctl_cap)(struct mem_ctl_info *mci, struct amd64_pvt *pvt); }; int __amd64_read_pci_cfg_dword(struct pci_dev *pdev, int offset, From patchwork Mon May 9 14:55:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 12843735 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 C36B2C433EF for ; Mon, 9 May 2022 14:56:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237765AbiEIPAM (ORCPT ); Mon, 9 May 2022 11:00:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237931AbiEIPAB (ORCPT ); Mon, 9 May 2022 11:00:01 -0400 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam07on2041.outbound.protection.outlook.com [40.107.212.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF5C21683FC; Mon, 9 May 2022 07:56:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LkbF3tKHwr1UFujdQpCvP73wjEwO8Jab+UgOBlHJT/aQyDv433yBlfJlbWAu3ircQZNKD2hFkknL1KaJ11HgvRd312MWZpxO2IAW1Ohcvu95vd9m15fs6IV3HAOsHjFjgFdSOM88OOGNNfQje+NhyNkeiPYXe/8UOMJ8zBacDxnEoDwLQNvQ2N4WuM4T6HN9b6JfT6wa4ZQlDY3YM4zjbqGv0QYB3aRpAL2sG+XJEvPTH5OKsrWJC32KV/zPpoBeSqC/8eCKBdbpqS+oIQtIQmyx1iOeI9+lQmPPqierB/IJoQPwzg5Hk0nkBQ7YMcpOvHTbgsjV20QvX4XKlWXxrA== 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=S8tayhatuj8M//w0xxmlIemqmC3IGAGwMXg9BunPyG4=; b=FfZFFbVEYO28KF8CT4E4TfXRPMXRHpGhwAqTYn5VzUAoQyp6Fc/ySj4yRwkwDoE6YBRjA/i+M39D+AaMu+WIan4r3N/CmtWko2Xd0VKSk862Lq01RRPJEsJtumHXcgz6Oz1z+IOQ/B4BIZXfUKurr+5LFYlHpHpnsFCfQ31nFQAdz4IBz8Dm9PrRGxnqcBwrRnwVB4d47AkuY5tOVAap3nedGP2rmDVU3VYbuvZCM975mJAODLCENDkenNxUGt8mRkwk5onBJxzz4RJ8QuIpJVLhoqFjsezEfR1gpNXqUk1UE86wawBmr7etH4ChPo8U97tCKXkY7BwfyloK4kKH1Q== 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=S8tayhatuj8M//w0xxmlIemqmC3IGAGwMXg9BunPyG4=; b=AOpTPP+gr53At8fYzMQb1njct+xh4KK41gpYAWrh+Udv83ACm7UFWVopD7Kseg7jj9b2ba1BmI6D+onA6/sO2AYsoM+pE+ZFNGnt2QZ4v6jZ5s61bKujIjv5ktvgYFEFHyyfyL9gM0Ftl/kyAA3aih/7tBKfuc9+Ap8PIEo9Uc8= Received: from MW4PR03CA0020.namprd03.prod.outlook.com (2603:10b6:303:8f::25) by CY4PR1201MB0214.namprd12.prod.outlook.com (2603:10b6:910:25::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.23; Mon, 9 May 2022 14:55:58 +0000 Received: from CO1NAM11FT009.eop-nam11.prod.protection.outlook.com (2603:10b6:303:8f:cafe::92) by MW4PR03CA0020.outlook.office365.com (2603:10b6:303:8f::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.23 via Frontend Transport; Mon, 9 May 2022 14:55:58 +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; Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT009.mail.protection.outlook.com (10.13.175.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5227.15 via Frontend Transport; Mon, 9 May 2022 14:55:58 +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.24; Mon, 9 May 2022 09:55:51 -0500 From: Yazen Ghannam To: , CC: , , , , Yazen Ghannam Subject: [PATCH 14/18] EDAC/amd64: Add setup_mci_misc_attrs() into pvt->ops Date: Mon, 9 May 2022 14:55:30 +0000 Message-ID: <20220509145534.44912-15-yazen.ghannam@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509145534.44912-1-yazen.ghannam@amd.com> References: <20220509145534.44912-1-yazen.ghannam@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2eebd783-105e-463b-1239-08da31cc06b7 X-MS-TrafficTypeDiagnostic: CY4PR1201MB0214:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: E3pAZ8L7uo2+j+xyIZcOBwSLq2TcqIhg17qxD4Gc+CEc5rUmOqqA7AK3KzSJhxo8gzip3F0Dn0MiYs4jv9GCEEctEE1NinqL/aVAy/YQ1U72pi8Q70A3e0vxJBOzH+BNWk6p8Tf2fE3pvZI4j7HE9jt9jJNDmfRtmpd2M1GmbhYaKrgdqyP6msJ443wzEAwRzxWjvS/Yl0CgSfI0NZPBfWikuC7Hd/XaqAPW+ar4wnf0NkUoF+b7AcJgs9LDUAFgJ136KStTBX75E+RqtSiWYZxSFVO//uVlfq/xaiNAlA0Ndxh2xIWo6gsTL6IVQxZBM97lYyQh2wzpVCYpQHXHcX72ulGERpZQTYf9hbRZaBcGMQDFteaG3yd9WX6aPDJTjgFeYbUTv2Wk9KNMPEZVlEyrkKm1t4Y/EsA4FCGCL1cYHyI6LskQEVQWohzPuLKamnzdZWO4O9g5QcQdcKB3RO2Yf+EAqk0Xgx+Oj4lBCA/6nj3qljYfut15fjDieFWMV3CZj0me83SIKfKm4uQR9nYjCytxRzvN7VPhJpQnu09nEnpk05t8f0vq309E7It/UyZDp51C/Y04LHGPWn6x4/BqZaw6oJYCuejo3LR7ZTJAapCzUaf6NMV0DvAnbka8ODPMsK3u78UcTl2ujebJKNGkFY/VejSkIhD0HzPdkwRekKj97AjoPtJjbU5B2YLZyqz8n7nd0DY3sv3DRhPltw== 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:(13230001)(4636009)(36840700001)(40470700004)(46966006)(16526019)(8936002)(4326008)(8676002)(70206006)(86362001)(70586007)(82310400005)(186003)(36756003)(426003)(54906003)(5660300002)(36860700001)(508600001)(83380400001)(316002)(336012)(47076005)(110136005)(44832011)(6666004)(2906002)(81166007)(40460700003)(356005)(7696005)(2616005)(26005)(1076003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 May 2022 14:55:58.0378 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2eebd783-105e-463b-1239-08da31cc06b7 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: CO1NAM11FT009.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1201MB0214 Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org From: Muralidhara M K GPU Nodes will expose the memory controller attributes differently than current systems. A function pointer should be used rather than introduce another branching condition. Prepare for this by adding setup_mci_misc_attrs() to pvt->ops. Legacy and modern systems use the same function. A new function will be added for GPU Nodes. Signed-off-by: Muralidhara M K Signed-off-by: Naveen Krishna Chatradhi [Rebased/reworked patch and reworded commit message] Signed-off-by: Yazen Ghannam --- drivers/edac/amd64_edac.c | 4 +++- drivers/edac/amd64_edac.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index b99eaa73131e..f1346416e64d 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -3768,6 +3768,7 @@ static struct low_ops umc_ops = { .ecc_enabled = umc_ecc_enabled, .determine_edac_cap = umc_determine_edac_cap, .determine_edac_ctl_cap = umc_determine_edac_ctl_cap, + .setup_mci_misc_attrs = setup_mci_misc_attrs, }; /* Use Family 16h versions for defaults and adjust as needed below. */ @@ -3783,6 +3784,7 @@ static struct low_ops dct_ops = { .ecc_enabled = dct_ecc_enabled, .determine_edac_cap = dct_determine_edac_cap, .determine_edac_ctl_cap = dct_determine_edac_ctl_cap, + .setup_mci_misc_attrs = setup_mci_misc_attrs, }; static int per_family_init(struct amd64_pvt *pvt) @@ -4001,7 +4003,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 15521adec9b5..93de7dea516a 100644 --- a/drivers/edac/amd64_edac.h +++ b/drivers/edac/amd64_edac.h @@ -476,6 +476,7 @@ struct low_ops { bool (*ecc_enabled)(struct amd64_pvt *pvt); unsigned long (*determine_edac_cap)(struct amd64_pvt *pvt); void (*determine_edac_ctl_cap)(struct mem_ctl_info *mci, 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 Mon May 9 14:55:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 12843736 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 2945DC433F5 for ; Mon, 9 May 2022 14:56:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237752AbiEIPAN (ORCPT ); Mon, 9 May 2022 11:00:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237924AbiEIPAB (ORCPT ); Mon, 9 May 2022 11:00:01 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2059.outbound.protection.outlook.com [40.107.244.59]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD73826AD96; Mon, 9 May 2022 07:56:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y5RhS3GNaFRKxwq0Jeuvl2xK7DN5eu/uTeGDVGUxmWQbJ8E3q+ErJUq01vm9gtZmpa4IYe7G2H98QYXb5lzF66F0Fcn3S0bzYXHUVhxA4azP3rTG+hrFkhfgCoCnRdbS3hVgDHFO72zMaml0sBdsSiMyjUuea4sndxWUOy3Cm4CetzU8bz+5ebeC+LqfT2k8KWYn5e4D2Q7D9etLWzj+RYMsZQjgzKOajF0srN0FPKjNKQkeENOBLj7Vd/hFWorPEcMwyAm4kFT04BNjns/ASrnibQNEYs1sGy+3c1DBagyZ0jE3FlkKlYPUa5f3xybwWn4byqGo8sxZCPgsONnOpA== 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=UcrUouRoDm/a16hih5Lg6+RJB/Zpivee3AE40dDK61Y=; b=en7HzdEWlM7vNHesJpxygnL6CB4xss12DaBReby1BvhrUkYi9WZLrIw923gWNeoGwVFOy3heThxojFP1/X2sGvKEpBip0gMZUEZYloe5QwMLamTTjraDH+eTirFDuZLaDdPKiwH87kTObDM86+LGlAXj6iPqjDeh+LvtOnrXIbzb8P+xtjIqqb8y9/3djwYAAEGg19GaHdBue3cPVcBHhcdaan/6QAttM0QkOO900tJPhTy8KbhUqrYTUR9byhrKG8zUb2Glj98M7GnpO02hzv2mq+uMJ1hl5e/rtYySLqSLRBU4CYfFpbyhJ+KUJfVZAMS3GJ76vPy23O7c5IfkGg== 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=UcrUouRoDm/a16hih5Lg6+RJB/Zpivee3AE40dDK61Y=; b=1zO8NGXujps/zrcUfnNyz37zcwKnbBejvEQzG/Ybu/SHNQxbe3xqoP6/lbr3rIE5efmc40irKirQFNgN+yxNLuyYl57uIcwhg+wYFQrzRvkmIxJ56Vw62kQ1eOeI34gT1cYhj0wRe6F5VO1tocKpL3K3bUobkDTSNSMM+2ZPw0I= Received: from MW4PR03CA0001.namprd03.prod.outlook.com (2603:10b6:303:8f::6) by BY5PR12MB4163.namprd12.prod.outlook.com (2603:10b6:a03:202::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.18; Mon, 9 May 2022 14:55:59 +0000 Received: from CO1NAM11FT009.eop-nam11.prod.protection.outlook.com (2603:10b6:303:8f:cafe::59) by MW4PR03CA0001.outlook.office365.com (2603:10b6:303:8f::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.20 via Frontend Transport; Mon, 9 May 2022 14:55:58 +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; Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT009.mail.protection.outlook.com (10.13.175.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5227.15 via Frontend Transport; Mon, 9 May 2022 14:55:58 +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.24; Mon, 9 May 2022 09:55:51 -0500 From: Yazen Ghannam To: , CC: , , , , Yazen Ghannam Subject: [PATCH 15/18] EDAC/amd64: Add init_csrows() into pvt->ops Date: Mon, 9 May 2022 14:55:31 +0000 Message-ID: <20220509145534.44912-16-yazen.ghannam@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509145534.44912-1-yazen.ghannam@amd.com> References: <20220509145534.44912-1-yazen.ghannam@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3fef4685-f6e9-4721-0c40-08da31cc0714 X-MS-TrafficTypeDiagnostic: BY5PR12MB4163:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: f3g/Y/+9OjxWa2Q9sSpMp5ey4C9JLrD8Us6uOp4wm9ZpRs4gbuf7au5N5POEytSnp3tObu67/5jql6dATgsSUKF5NWz0n94tJt+Rx5+O5PKPAzICGYEa+ENVkdRoo7XDZJakA+dfuFIvRaLo7OqsfCSIDDJeA6Gm9I/VDHhZEXb8JQ/+2nPY//WVjDlMS433fdS+fYy1++e2UeNKYQZCx/OREvkRi6ldxKeXPaehyRRgGI88nNR0lCkG9BELnRQZYUT7dcp4P5ppGKdKjFQgRBqv6A0FmFHq3CwZ5gK04kkjSIQXHYZ+UdayQ00uclwD4cMM22LoFDLeTiQGtrFtaRAEGqYOrOG/2LUGC5W004SR6mgBE7uaq2fAqJ1tW4oPZgM5uAxVl2LH0wXMjhX9CxCOQYNXmBfFnB9saN69IkAbTuCHdLOA4XsC8JxbOSZQJiib/HHCckSuNIKxoLTvedpKQFOC6LVtUBxm9VPZID2bwGLsOEhdc8X4EwFAHrtQY/11E9FQEoIWlDn+IGmd2gCPY7b7yUbMupwbFASaIA38gqz2GOHYMnxDjKZKU+qyBTOwbrtggjanjT+arV6iXae7aIdl9hWa9SnPkE1fjhgGXHnqeXcvnbxiMhYG4bRpCEbiF517OCXwhbVvKdnBNpkr+u6Wx05BJ+GT/dw7gBk1kwjLE8Rlmt+SV5vYBwDWSrTryR06ptn9NiuXeAdGYQ== 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:(13230001)(4636009)(40470700004)(36840700001)(46966006)(316002)(508600001)(8936002)(36860700001)(110136005)(16526019)(54906003)(356005)(86362001)(8676002)(4326008)(70206006)(70586007)(2906002)(40460700003)(26005)(44832011)(6666004)(83380400001)(7696005)(1076003)(186003)(2616005)(47076005)(82310400005)(336012)(426003)(36756003)(5660300002)(81166007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 May 2022 14:55:58.6315 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3fef4685-f6e9-4721-0c40-08da31cc0714 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: CO1NAM11FT009.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4163 Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org From: Muralidhara M K GPU Nodes will use a different method to enumerate the chip select (struct dimm_info) values. A function pointer should be used rather than introduce another branching condition. Prepare for this by adding init_csrows() to pvt->ops and set it as needed based on currently supported systems. Use a "umc" prefix for modern systems, since these use Unified Memory Controllers (UMCs). Use a "dct" prefix for newly-defined legacy functions, since these systems use DRAM Controllers (DCTs). Signed-off-by: Muralidhara M K Signed-off-by: Naveen Krishna Chatradhi [Rebased/reworked patch and reworded commit message] Signed-off-by: Yazen Ghannam --- drivers/edac/amd64_edac.c | 11 +++++------ drivers/edac/amd64_edac.h | 1 + 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index f1346416e64d..5beeeb2fd6a8 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -3357,7 +3357,7 @@ static u32 get_csrow_nr_pages(struct amd64_pvt *pvt, u8 dct, int csrow_nr_orig) return nr_pages; } -static int init_csrows_df(struct mem_ctl_info *mci) +static int umc_init_csrows(struct mem_ctl_info *mci) { struct amd64_pvt *pvt = mci->pvt_info; enum edac_type edac_mode = EDAC_NONE; @@ -3405,7 +3405,7 @@ static int init_csrows_df(struct mem_ctl_info *mci) * 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 int dct_init_csrows(struct mem_ctl_info *mci) { struct amd64_pvt *pvt = mci->pvt_info; enum edac_type edac_mode = EDAC_NONE; @@ -3415,9 +3415,6 @@ static int init_csrows(struct mem_ctl_info *mci) int nr_pages = 0; u32 val; - if (pvt->umc) - return init_csrows_df(mci); - amd64_read_pci_cfg(pvt->F3, NBCFG, &val); pvt->nbcfg = val; @@ -3768,6 +3765,7 @@ static struct low_ops umc_ops = { .ecc_enabled = umc_ecc_enabled, .determine_edac_cap = umc_determine_edac_cap, .determine_edac_ctl_cap = umc_determine_edac_ctl_cap, + .init_csrows = umc_init_csrows, .setup_mci_misc_attrs = setup_mci_misc_attrs, }; @@ -3784,6 +3782,7 @@ static struct low_ops dct_ops = { .ecc_enabled = dct_ecc_enabled, .determine_edac_cap = dct_determine_edac_cap, .determine_edac_ctl_cap = dct_determine_edac_ctl_cap, + .init_csrows = dct_init_csrows, .setup_mci_misc_attrs = setup_mci_misc_attrs, }; @@ -4005,7 +4004,7 @@ static int init_one_instance(struct amd64_pvt *pvt) pvt->ops->setup_mci_misc_attrs(mci); - if (init_csrows(mci)) + if (pvt->ops->init_csrows(mci)) mci->edac_cap = EDAC_FLAG_NONE; ret = -ENODEV; diff --git a/drivers/edac/amd64_edac.h b/drivers/edac/amd64_edac.h index 93de7dea516a..1b879c3cfb36 100644 --- a/drivers/edac/amd64_edac.h +++ b/drivers/edac/amd64_edac.h @@ -477,6 +477,7 @@ struct low_ops { unsigned long (*determine_edac_cap)(struct amd64_pvt *pvt); void (*determine_edac_ctl_cap)(struct mem_ctl_info *mci, struct amd64_pvt *pvt); void (*setup_mci_misc_attrs)(struct mem_ctl_info *mci); + int (*init_csrows)(struct mem_ctl_info *mci); }; int __amd64_read_pci_cfg_dword(struct pci_dev *pdev, int offset, From patchwork Mon May 9 14:55:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 12843737 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 ED4EBC4332F for ; Mon, 9 May 2022 14:56:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237659AbiEIPAP (ORCPT ); Mon, 9 May 2022 11:00:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237915AbiEIPAA (ORCPT ); Mon, 9 May 2022 11:00:00 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2071.outbound.protection.outlook.com [40.107.220.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1505624BB3C; Mon, 9 May 2022 07:56:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lart38qQF3Ixr4PDpYS9SC61KZpO7TYWLkkDoKfp7e8wglbuJJO5T2zW4cOP83tRWjcJg0MzB6efhJaup+RNauloLSzKbTg77MIMArghDtu5jfPhoEo7xhx9wseBNIznSwzMqeQexZ2tMQyvHawjVd591VS1wFwKp27+v+/cNVdA2Fn5bbsHkWRdYUXNhzmqD7RQLnZyZdMBDkk1cG1jX8kEqkQX4h9swp90G7NzflYoFIqehFQdC24eKpCsse7SR3opgzJ3ce/MtgVLKmT++7G2FCSP7pBfWNZprxanfzoz3/nqtkq1mNEiay8La0pl9kxV1Dr6DK5J2dRdaqYNGQ== 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=3/9uipsGXJHM3Xgxbxirb1tYrINsZH6/D+fhAqxkgIc=; b=fpuzaLJyZmNHkOFbXTAWC79DVLWR1cvqF1ebGC3T3QTAuOZGiJjyHspE47pq/s2yqXxU0lKauMAxtMD1IQBVha66SBzsEd10l+Daislxqyz2nEoBaCIt8LX5cnzJBmnabwEV2Annlp64blm5ttnunffRjOLdmgEipM/1PamcrrYSSkeR272wp84dRQQk08AaAn1lZZmCoy4Q8grjZTP0fv6WHERSIuQMbpc9QbVqdrXgMX859NIk/jeFOKHD/dUJBxM5cgjEMKKYwBHLUjoiNTKB4IlUVVvAWoBvFJ2wuXUUd6YU1AxkVTDOy2uAq1EndmK+sN6aIpZ0BoX4fQGLCw== 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=3/9uipsGXJHM3Xgxbxirb1tYrINsZH6/D+fhAqxkgIc=; b=NdvPJMiAWQxOlX3QpefRpqNZ7sq008Vx7z0KMVnjXGjcz73uZcKjpUCBXdyJlgfU5TcbhpSYyHyK3mrZuuIEqFpw1GIvTKe83AAJX7/Lq1Co7xid2lkvX42pDNz7FRtcPIeopAwVppZb+8CogjWafPrt043wc2PIXlJScWySs3Q= Received: from MW4PR03CA0221.namprd03.prod.outlook.com (2603:10b6:303:b9::16) by CY5PR12MB6276.namprd12.prod.outlook.com (2603:10b6:930:f::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.20; Mon, 9 May 2022 14:55:59 +0000 Received: from CO1NAM11FT012.eop-nam11.prod.protection.outlook.com (2603:10b6:303:b9:cafe::7d) by MW4PR03CA0221.outlook.office365.com (2603:10b6:303:b9::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5206.24 via Frontend Transport; Mon, 9 May 2022 14:55:59 +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; Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT012.mail.protection.outlook.com (10.13.175.192) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5227.15 via Frontend Transport; Mon, 9 May 2022 14:55:58 +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.24; Mon, 9 May 2022 09:55:51 -0500 From: Yazen Ghannam To: , CC: , , , , Yazen Ghannam Subject: [PATCH 16/18] EDAC/amd64: Add dump_misc_regs() into pvt->ops Date: Mon, 9 May 2022 14:55:32 +0000 Message-ID: <20220509145534.44912-17-yazen.ghannam@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509145534.44912-1-yazen.ghannam@amd.com> References: <20220509145534.44912-1-yazen.ghannam@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1773b72f-abe8-4fe4-b29c-08da31cc074a X-MS-TrafficTypeDiagnostic: CY5PR12MB6276:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3s/Tep/cilmP+pUCKLZ0kyEdP83Tbbm2e6codtvCcWZvhkSCmkhRuu1QxqAgZbKYw96cFUk/OexZP1b8vP4zKuKebH7JlK7zQKUyhvOLYn0DuQBTmRxjycdHQgE8EBlO++48dXAe6Z/3xmmlusBNxTfTWyjOWLwqmaMN12DDxnf+gpg98d51l+sq1cNA2jp2uFi/fiUh8xlv5B0HRRIkTsDnTk8nPcUbx26shYZ0nuz+q/8jdWvYSBFIoE5yxl+wj+5ctu3yimWKqyCmnaYQ20S4W2olFXBlBPd5yNjbiL87SbXDGmtjhiRaMUsXIEex7L69Uyy9JKEnxjp61I0/VnNxRDpDqirOCwHZ3+esBU3jFFG0jtqXc1ozlrocUqOVrIMlnELtA/IqPi3FNcidJtVeM6/gJ4SYDF9reKBosbPmHz6T5tG08YSk2Q5EcIWmBVf+b5JEKLURvIO19bFtWZqImU76tFWlO4DHQ5P9Ska0cSkq4C+AHo+kLJYM/2FD7kYdEA9yDUZlT+Iz6emnduPyEJ27+JAXEaZGYp4M0QTZlL5VswYQgn/LMnjDa+KF7N+5GhrM7P1Mujz6EhZR3RmSDgTvUj1rI1JZkthNo9jJOSkZgTqCPl86XBpeQOjBCCpN6cO4fosDekbsSkjiajSJTFMPsqoQNft667UAKO4evBoyLmbgdwhpkgNqxnnrsDBU8kWECdyHhnbfs/WScA== 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:(13230001)(4636009)(40470700004)(36840700001)(46966006)(508600001)(316002)(8936002)(36860700001)(110136005)(16526019)(54906003)(8676002)(356005)(4326008)(86362001)(70206006)(70586007)(44832011)(26005)(83380400001)(6666004)(40460700003)(7696005)(186003)(1076003)(2616005)(426003)(336012)(82310400005)(2906002)(47076005)(36756003)(5660300002)(81166007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 May 2022 14:55:58.9896 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1773b72f-abe8-4fe4-b29c-08da31cc074a 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: CO1NAM11FT012.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6276 Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org From: Muralidhara M K GPU Nodes will print out different information and registers compared to existing systems. A function pointer should be used rather than introduce another branching condition. Prepare for this by adding dump_misc_regs() to pvt->ops and set it as needed based on currently supported systems. Use a "umc" prefix for modern systems, since these use Unified Memory Controllers (UMCs). Use a "dct" prefix for newly-defined legacy functions, since these systems use DRAM Controllers (DCTs). Signed-off-by: Muralidhara M K Signed-off-by: Naveen Krishna Chatradhi [Rebased/reworked patch and reworded commit message] Signed-off-by: Yazen Ghannam --- drivers/edac/amd64_edac.c | 21 ++++++--------------- drivers/edac/amd64_edac.h | 1 + 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 5beeeb2fd6a8..b4c9d224f564 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -1394,7 +1394,7 @@ static void debug_display_dimm_sizes_df(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; @@ -1437,8 +1437,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); @@ -1473,17 +1472,6 @@ static void __dump_misc_regs(struct amd64_pvt *pvt) edac_dbg(1, " DramHoleValid: %s\n", dhar_valid(pvt) ? "yes" : "no"); } -/* 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); - - amd64_info("using x%u syndromes.\n", pvt->ecc_sym_sz); -} - /* * See BKDG, F2x[1,0][5C:40], F2[1,0][6C:60] */ @@ -3766,6 +3754,7 @@ static struct low_ops umc_ops = { .determine_edac_cap = umc_determine_edac_cap, .determine_edac_ctl_cap = umc_determine_edac_ctl_cap, .init_csrows = umc_init_csrows, + .dump_misc_regs = umc_dump_misc_regs, .setup_mci_misc_attrs = setup_mci_misc_attrs, }; @@ -3783,6 +3772,7 @@ static struct low_ops dct_ops = { .determine_edac_cap = dct_determine_edac_cap, .determine_edac_ctl_cap = dct_determine_edac_ctl_cap, .init_csrows = dct_init_csrows, + .dump_misc_regs = dct_dump_misc_regs, .setup_mci_misc_attrs = setup_mci_misc_attrs, }; @@ -4093,7 +4083,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 1b879c3cfb36..4e7467c285b9 100644 --- a/drivers/edac/amd64_edac.h +++ b/drivers/edac/amd64_edac.h @@ -478,6 +478,7 @@ struct low_ops { void (*determine_edac_ctl_cap)(struct mem_ctl_info *mci, struct amd64_pvt *pvt); void (*setup_mci_misc_attrs)(struct mem_ctl_info *mci); int (*init_csrows)(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 Mon May 9 14:55:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 12843734 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 1D649C4332F for ; Mon, 9 May 2022 14:56:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237942AbiEIPAJ (ORCPT ); Mon, 9 May 2022 11:00:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237917AbiEIPAA (ORCPT ); Mon, 9 May 2022 11:00:00 -0400 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam08on2045.outbound.protection.outlook.com [40.107.102.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14E8424BB34; Mon, 9 May 2022 07:56:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GsJimNxvvezGR91Y9nhMlCIZZ9EMHtZoim/LDKFOGeW+0vhLysyRL4XMF8avgBCHPrzWLPXGSFDyL/Gpjx3FuaumZAJzwA2YZZo2oEyAyyd/Rkbsd0TDyiVqYF2g5WJmq7d6xKmdsvN7DbaPxbIFtzCn+RsdT3+ADScfH1OosidrMI8K8ViwimO2nEAntq5YLxVJDOQTt5KE4SKFNaLwmjWtz08LaphMndnEW1D17vB59LjRbvPCGewDDvkE3NaP/q/JtBtzFFEyFb3EpTN2gXvbbCVYzWi+F/DJOnEfP6ZJEbrhbyMhFg4Fi9FVVWZSwGdtT+Xoii/uEI7b0Zxdbw== 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=lk+eGPeI5rDHjsPqUhb9X8LF5O3iDJFT5LZ+MgrAfpQ=; b=OIjUoBOlvaho/mZPCtJk/ih575aC3SQ46X0hwOSnpDFvNblYPIBFL1nMBX9dMsmhtG45A5O9mOH1MEXdwqVvLmPhhXoTYDJjgYIb7I4AMcRI8D261lyBeNLfbI+T6IJqutRqlCPEY2/OhjsZZgR9SeMHx2+v2wF6F1hq4Oo87YjACm6myTKr2L24QXdE/8oNHBhzZX0bSos1oe85YoyqslPYHEPzxODGOpvz/jtvLjxAUhXoejBGcrHw5F/E9wf1xzrYq6hqq/CxqaYd9iaEr1DXaykG/tJRL0pXzxxEI4JhJoiYJrdGm/kLRR+Qj2U/2plW3cyOMJiqCakRNg9pVA== 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=lk+eGPeI5rDHjsPqUhb9X8LF5O3iDJFT5LZ+MgrAfpQ=; b=dLZXCOIBKKUxiM4VNTNV5LDtMzFHNkIaAMLcC/l7EgUBMmccHTifJUnaoTXT1pGHoQP7zK63VfZjGqEZelfQLAfluFKXSaFRqxRppan8l5/nIea90SjeBqKLP+Ft9YHm2t4Nvybjk+7cAj3ne7UXprOYEm1vX/SkLc4dLwXvXgM= Received: from MW4PR03CA0022.namprd03.prod.outlook.com (2603:10b6:303:8f::27) by BN9PR12MB5082.namprd12.prod.outlook.com (2603:10b6:408:133::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.21; Mon, 9 May 2022 14:55:59 +0000 Received: from CO1NAM11FT009.eop-nam11.prod.protection.outlook.com (2603:10b6:303:8f::4) by MW4PR03CA0022.outlook.office365.com (2603:10b6:303:8f::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.21 via Frontend Transport; Mon, 9 May 2022 14:55:59 +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; Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT009.mail.protection.outlook.com (10.13.175.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5227.15 via Frontend Transport; Mon, 9 May 2022 14:55:59 +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.24; Mon, 9 May 2022 09:55:52 -0500 From: Yazen Ghannam To: , CC: , , , , Yazen Ghannam Subject: [PATCH 17/18] EDAC/amd64: Add get_cs_mode() into pvt->ops Date: Mon, 9 May 2022 14:55:33 +0000 Message-ID: <20220509145534.44912-18-yazen.ghannam@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509145534.44912-1-yazen.ghannam@amd.com> References: <20220509145534.44912-1-yazen.ghannam@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e0e1233f-5005-428d-8f89-08da31cc077a X-MS-TrafficTypeDiagnostic: BN9PR12MB5082:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mSuQmF+FyNQ9xVXphbKSqAu5tRdLYnGd22UsuINHSNDqswy3IPbxR5dcvEx39QDbaPaYE/ohfzPACcxWQAlf9aRaJjbIw53N2J+wg5OTRh9bUGBDzI8ALRtaX+9/6epgCOUw2ZfS3BWCwhdKmNXHWFX255sIPr+DgyrJvozu64xbDo7hMWu7bj9aGV5E6efsOugNEEkjUlR32vSsl0KqBGmBfNkWzvv6PKJSBO4Lkqmna6dwv+PcEJZb4gpMF2er53prMN14gC65F8YJze6ngfBdMUZv2bDVw4dT01f1FvPmt116d5KDJcVDtuLb4QtuyIwaPw/fMHUb7FzIivl9nTygm1mjICswHHvAGUCOvwDwtCKRZ+P0sTNpMK2ZqsHVCkmI5xBOrz+MbZkZjv1bnkE3FZEgty5GbzcQf6zJyt+5KfcwT81hRiDt62UHM1DwIx7ql1eYHZ9jJEDngZwgtEusZ5pn87Rr2+eyR3hD7RXcUUow31ahzW9QrsfCBcHFv8YJdpZqTP1JMSqxrfs8vem7cAC6BZucbwQXtJ6WjUGCnzlQRrZ7ehKQ0mmhGckLxx5OKpCygVVjSoqWZLXlv+zZPoR/d2DR0lp07h9IwqlO4zexoxPo+sWiweMXh9gNZpOXDA2MZ4OLOa1/o19ZzcefuWPEQXCwoKRIhuKIOMTl1M/9oa8uEHyMxVKs+i4OAAa8lylfFAIiNrw6lKxKzg== 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:(13230001)(4636009)(36840700001)(46966006)(40470700004)(2616005)(8676002)(70586007)(8936002)(1076003)(81166007)(508600001)(426003)(83380400001)(336012)(186003)(70206006)(47076005)(4326008)(26005)(86362001)(6666004)(316002)(82310400005)(54906003)(7696005)(110136005)(40460700003)(356005)(36860700001)(2906002)(44832011)(36756003)(5660300002)(16526019)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 May 2022 14:55:59.3189 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e0e1233f-5005-428d-8f89-08da31cc077a 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: CO1NAM11FT009.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5082 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 mode used on a controller. A function pointer should be used rather than introduce another branching condition. Prepare for this by adding get_cs_mode() to pvt->ops and set it as needed based on currently supported systems. Use a "umc" prefix for modern systems, since these use Unified Memory Controllers (UMCs). Use a "dct" prefix for newly-defined legacy functions, since these systems use DRAM Controllers (DCTs). Signed-off-by: Muralidhara M K Signed-off-by: Naveen Krishna Chatradhi [Rebased/reworked patch and reworded commit message] Signed-off-by: Yazen Ghannam --- drivers/edac/amd64_edac.c | 21 ++++++++++++--------- drivers/edac/amd64_edac.h | 1 + 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index b4c9d224f564..248d1082736e 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -1341,7 +1341,14 @@ 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 dct_get_cs_mode(int dimm, u8 ctrl, struct amd64_pvt *pvt) +{ + u32 dbam = ctrl ? pvt->dbam1 : pvt->dbam0; + + return DBAM_DIMM(dimm, dbam); +} + +static int umc_get_cs_mode(int dimm, u8 ctrl, struct amd64_pvt *pvt) { u8 base, count = 0; int cs_mode = 0; @@ -1383,7 +1390,7 @@ static void debug_display_dimm_sizes_df(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); @@ -3324,16 +3331,10 @@ static void dct_read_mc_regs(struct amd64_pvt *pvt) */ static u32 get_csrow_nr_pages(struct amd64_pvt *pvt, u8 dct, int csrow_nr_orig) { - 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); - } + cs_mode = pvt->ops->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; @@ -3755,6 +3756,7 @@ static struct low_ops umc_ops = { .determine_edac_ctl_cap = umc_determine_edac_ctl_cap, .init_csrows = umc_init_csrows, .dump_misc_regs = umc_dump_misc_regs, + .get_cs_mode = umc_get_cs_mode, .setup_mci_misc_attrs = setup_mci_misc_attrs, }; @@ -3773,6 +3775,7 @@ static struct low_ops dct_ops = { .determine_edac_ctl_cap = dct_determine_edac_ctl_cap, .init_csrows = dct_init_csrows, .dump_misc_regs = dct_dump_misc_regs, + .get_cs_mode = dct_get_cs_mode, .setup_mci_misc_attrs = setup_mci_misc_attrs, }; diff --git a/drivers/edac/amd64_edac.h b/drivers/edac/amd64_edac.h index 4e7467c285b9..1f64c08ae0ce 100644 --- a/drivers/edac/amd64_edac.h +++ b/drivers/edac/amd64_edac.h @@ -479,6 +479,7 @@ struct low_ops { void (*setup_mci_misc_attrs)(struct mem_ctl_info *mci); int (*init_csrows)(struct mem_ctl_info *mci); void (*dump_misc_regs)(struct amd64_pvt *pvt); + int (*get_cs_mode)(int dimm, u8 ctrl, struct amd64_pvt *pvt); }; int __amd64_read_pci_cfg_dword(struct pci_dev *pdev, int offset, From patchwork Mon May 9 14:55:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 12843738 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 C4580C433EF for ; Mon, 9 May 2022 14:56:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237759AbiEIPAQ (ORCPT ); Mon, 9 May 2022 11:00:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237914AbiEIPAA (ORCPT ); Mon, 9 May 2022 11:00:00 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2082.outbound.protection.outlook.com [40.107.223.82]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14D3524BB29; Mon, 9 May 2022 07:56:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GXmH2EH9fAxP2jAOPpQn5FSbLCm73Q7RGWddalGMsSN7VYJ91WumVEol4qyUTIK/YfiVZZ3LWxDB24I7wKoRPSZ6VFjR5Ijz2yP2DkWGasGv9kWm8GOGt6AJRR4NSeiZlh+d/ak0OD88qY5ilEvr+wfiVcmdwzk8RYda0ewU+jBMqmRT+iY0sUvcWnfj8zJXkPkl/stj52MxMXg26w1XxzsyhO0eZWcmGQo57CRxxN71vgsYZ+8CfE6uzc+IYmxr5QOFtQKuhI+9i0RuiIQnhoyKSTn9hAqdNw4dWzzVHC+aChjIWKQUNTtSnSn+pbnYJzTc6Aajou+xyGwWNz74Qw== 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=WOP6sdubyHv8i9LkxrD85AO2qRI7kXMvNjTNtlJkwNg=; b=DNQSDPy2AVdvakfGWnU4TPE5MvpV7hVucNmpp2I92U2UwTK/0bENlfa7GlashBcaSzskkMVsFNWT3NQAVLeE5hjau9LIatiJ9Th5ubjBoOj7C6cBwdKOmgJjXO2JJ2lH4GTeJQecODR8nBd4FOn9u+cAAo4bICUaWmktG7Sl4kfUwWtJ+214jN30xLYJdmHkT0wutQJW7gCsnpSgwVwg/UlbboanPlo7Nvsq265cyZofAUW/7o2rqFvp9+HlyvBJeulwaqo4Y+n0szMg6nQHua9AvAinifAUPH3pEJ/KtWjry+R1lAW7H3UEyDJMgxfMXOcRpZuzZYzK+Rq2O970GA== 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=WOP6sdubyHv8i9LkxrD85AO2qRI7kXMvNjTNtlJkwNg=; b=bXKj9wqHSdkRk3evdlcOMQAjy58iQhUAMf7cuuP/slXIUL6J/yXIBGyrmIddNeaDRpXh4wlEkFDqEj6GJiOwrvAxnqR3jGDIRGGoV8mDmCF1bQJRbv6xx//g+eaQmFE1Gesg9+WZ5OG/a/ISqRTMfzGj968JLAk54AWBNfWKxvA= Received: from MW4PR03CA0215.namprd03.prod.outlook.com (2603:10b6:303:b9::10) by CH2PR12MB4181.namprd12.prod.outlook.com (2603:10b6:610:a8::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.21; Mon, 9 May 2022 14:55:59 +0000 Received: from CO1NAM11FT012.eop-nam11.prod.protection.outlook.com (2603:10b6:303:b9:cafe::17) by MW4PR03CA0215.outlook.office365.com (2603:10b6:303:b9::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.22 via Frontend Transport; Mon, 9 May 2022 14:55:59 +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; Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT012.mail.protection.outlook.com (10.13.175.192) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5227.15 via Frontend Transport; Mon, 9 May 2022 14:55:59 +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.24; Mon, 9 May 2022 09:55:52 -0500 From: Yazen Ghannam To: , CC: , , , , Yazen Ghannam Subject: [PATCH 18/18] EDAC/amd64: Add get_err_info() into pvt->ops Date: Mon, 9 May 2022 14:55:34 +0000 Message-ID: <20220509145534.44912-19-yazen.ghannam@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509145534.44912-1-yazen.ghannam@amd.com> References: <20220509145534.44912-1-yazen.ghannam@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 66ea85d1-2c1c-4a13-e817-08da31cc07a2 X-MS-TrafficTypeDiagnostic: CH2PR12MB4181:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: k8gOzJOPJPQ1jDZabKcjg220uNJCwrvkRMkyCOXWPBtrjIFSsD+nlGmGo9fotyQDCUHY3y2Sqx+B4qYV0VETVy+pD6HiWEj1lp6fu5pmqctXreqKcE/TDys43XKrArPFJhhJwtzbknPwul4dEm5EwgUaGNRp6mO5xbi3Qx4dGw56ujoqs5HkyB/mfDdN3UB1A2Ek0Bs2jSswYS7Tj6EiQk8IWTv74vDSoYlZcPCK5bk4NkKpTx8Q6O9hkg0JttZi80HnNFsItRHSjdIt+nxW5rl54RnMrKlQCninLYzLOMb/V9XvysCVF6zv+7uMLLlrXj4KnbxmGiBzsQUUKNNjUi03VSFyy0m268BdEn2X1nu6YDqgUHNhbalgit+DnDSHbgyfuzo3qee6YuDogm99yFMlePtxqRA6N7k5n6YI71cej6/KR6TliCe9dGzXGk/L2ZEmzCxrG7R+EBrsVCQQA6OK7+1+XF6SAMTNpW9RIu6tPIa1O7BuHgsW/rvUuqkwVAKXEmOhKyv0b3rLBnkVIh392MiakGv9lWRpDZDOlZWSWJ9D1wUBSAuDtqdY6dCF7A7pYmWECiFoO/9yjJrZhQc5GpmgJjUisr7PxC1VpUgQ9KPpMLBHp6ZXPmC3w0CJw0bhTUpeAUBuySF3N7pZn/9yjf+I21wJD1d55FHzmo0ZTyiulfpP2B6ft4Fb2NHFkpruSRDoeXB2+68kVMKEEw== 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:(13230001)(4636009)(46966006)(40470700004)(36840700001)(44832011)(2906002)(36756003)(356005)(40460700003)(36860700001)(16526019)(8936002)(81166007)(5660300002)(110136005)(4326008)(1076003)(186003)(83380400001)(70206006)(47076005)(426003)(336012)(508600001)(70586007)(8676002)(2616005)(82310400005)(54906003)(316002)(7696005)(6666004)(86362001)(26005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 May 2022 14:55:59.5677 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 66ea85d1-2c1c-4a13-e817-08da31cc07a2 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: CO1NAM11FT012.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4181 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. Use a "umc" prefix for modern systems, since these use Unified Memory Controllers (UMCs). Signed-off-by: Muralidhara M K Signed-off-by: Naveen Krishna Chatradhi [Rebased/reworked patch and reworded commit message] Signed-off-by: Yazen Ghannam --- drivers/edac/amd64_edac.c | 15 ++++++++++----- drivers/edac/amd64_edac.h | 1 + 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 248d1082736e..81d165bcd252 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -3067,10 +3067,16 @@ 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. + * + * csrow can be derived from the lower 3 bits of MCA_SYND value. + * + * 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) @@ -3092,8 +3098,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; @@ -3108,7 +3112,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; @@ -3757,6 +3761,7 @@ static struct low_ops umc_ops = { .init_csrows = umc_init_csrows, .dump_misc_regs = umc_dump_misc_regs, .get_cs_mode = umc_get_cs_mode, + .get_err_info = umc_get_err_info, .setup_mci_misc_attrs = setup_mci_misc_attrs, }; diff --git a/drivers/edac/amd64_edac.h b/drivers/edac/amd64_edac.h index 1f64c08ae0ce..d5a64b0639bb 100644 --- a/drivers/edac/amd64_edac.h +++ b/drivers/edac/amd64_edac.h @@ -480,6 +480,7 @@ struct low_ops { int (*init_csrows)(struct mem_ctl_info *mci); void (*dump_misc_regs)(struct amd64_pvt *pvt); int (*get_cs_mode)(int dimm, u8 ctrl, 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,