Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp2756177rwa; Mon, 22 Aug 2022 13:10:06 -0700 (PDT) X-Google-Smtp-Source: AA6agR4PUllpqety96UqrYTFppSaS3CA+tFEor9Pn9pShIB2RY7/T9HOPBZw0HXtRKVvy9ZTWUyH X-Received: by 2002:a17:903:32c4:b0:172:f641:c324 with SMTP id i4-20020a17090332c400b00172f641c324mr3568657plr.117.1661199005896; Mon, 22 Aug 2022 13:10:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661199005; cv=none; d=google.com; s=arc-20160816; b=OR0Dp8NcNjOy8VqXdSXAsmK7wJP3Z/AtXiU1iXfyWCbm/MTbUyXYVKVVXUQ748jq/K 54Q0CiDucXiPZz09+PwjV6IjfNlTEybPrYRbv/jvpqx94Hh7TzkVi1B6mgw3VhD8rvJ+ RKx7cjcHTsez3lXFMEi4SSGt/HnnlkvS30YBdcPAjfSolxmA3gS2EUQpopzyrl2cj9nh DVOiBBhaVJNtADVge1DAdKf1xWc1kD4poaY5LMI0p+myPwVeyqUgdm/ZLgHmPWOggyCr fkgBQitMUFeQUxHUMDzesJf/i73zo4aHmO+1o9NLUD6EQkGjGQ/en91a7y4Puxku73sY hq7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=hYISXOPwelQMZEnoI/XHwiZ9SYWjZeM4wKuUzRG7AZg=; b=tL+87ynGv72vl6yZh8AtwneTMdL94UmRAS8BraiJzVrn7k2cVeMH1nqQzz/dNX8uBw R0uMqsSbrW6/p7v3nd7sJ5RO1OxGIeSmp8XK6Qq87CqwfcjFLCqrqUb8OpaVBWwghQDe pWlKyz/onGKe2mafqDtCc0D3gjPLCSvMpDyAdFwRDFSdtJJOReggaBI3gtoH4kJvL6kY evPpt9hOkdcMPD1oms6wD4qWp/jL2ek4owIByu7ygImAeSVK+xUV2g5wbpgMB8VgfECf XxDJrJhBc4cjb2qSeyLrulRIPlMS0frkuHKUb4lEJUS4ucYc8A/DfC230uFpXAWFVLMY f8EA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baikalelectronics.ru header.s=mail header.b=CVqMr9a2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=baikalelectronics.ru Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q15-20020a635c0f000000b00427d4537a61si13663180pgb.252.2022.08.22.13.09.54; Mon, 22 Aug 2022 13:10:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@baikalelectronics.ru header.s=mail header.b=CVqMr9a2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=baikalelectronics.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235323AbiHVTWM (ORCPT + 99 others); Mon, 22 Aug 2022 15:22:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238699AbiHVTU5 (ORCPT ); Mon, 22 Aug 2022 15:20:57 -0400 Received: from mail.baikalelectronics.com (mail.baikalelectronics.com [87.245.175.230]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0CFC613D08; Mon, 22 Aug 2022 12:20:21 -0700 (PDT) Received: from mail (mail.baikal.int [192.168.51.25]) by mail.baikalelectronics.com (Postfix) with ESMTP id F3AD4DA5; Mon, 22 Aug 2022 22:23:29 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.baikalelectronics.com F3AD4DA5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baikalelectronics.ru; s=mail; t=1661196210; bh=hYISXOPwelQMZEnoI/XHwiZ9SYWjZeM4wKuUzRG7AZg=; h=From:To:CC:Subject:Date:In-Reply-To:References:From; b=CVqMr9a2i8OyAqPdjse8KdEXMb7CJiqMEPrqqZnHa83BaoCXuPH1Vqw/Pc8Ei87x4 zmAhXhx+IN+58j1KxMEiaJ47jHVCfoMEjwwjo77b5dxMU20QbkNSm19ArqSFu2wS6n /p3p5/1qKZtUVG3102H1WmvwppI32aas0TxXsT44= Received: from localhost (192.168.168.10) by mail (192.168.51.25) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 22 Aug 2022 22:20:15 +0300 From: Serge Semin To: Michal Simek , Borislav Petkov , Mauro Carvalho Chehab , Tony Luck , James Morse , Robert Richter CC: Serge Semin , Serge Semin , Alexey Malahov , Michail Ivanov , Pavel Parkhomenko , Punnaiah Choudary Kalluri , Manish Narani , Dinh Nguyen , Rob Herring , Krzysztof Kozlowski , , , , Subject: [PATCH 03/13] EDAC/synopsys: Add multi-ranked memory support Date: Mon, 22 Aug 2022 22:19:46 +0300 Message-ID: <20220822191957.28546-4-Sergey.Semin@baikalelectronics.ru> In-Reply-To: <20220822191957.28546-1-Sergey.Semin@baikalelectronics.ru> References: <20220822191957.28546-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS, T_SCC_BODY_TEXT_LINE,T_SPF_PERMERROR autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org DW uMCTL2 DDRC supports multi-rank memory attached to the controller. If so the MSTR.active_ranks field will be set with the populated ranks bitfield. It is permitted to have one, two or four ranks activated at a time [1]. Since we now have the number of ranks determined in the controller configuration detection procedure, it can be easily used for accordingly extending the MCI chip-select layer. In case of the ECC errors the affected rank will be read from the CE/UE address CSRs [2]. Note we need to drop the ranks from the total memory size calculation since multiple ranks are taken into account by means of the layer[0] definition. [1] DesignWare® Cores Enhanced Universal DDR Memory Controller (uMCTL2) Databook, Version 3.91a, October 2020, p.739 [2] DesignWare® Cores Enhanced Universal DDR Memory Controller (uMCTL2) Databook, Version 3.91a, October 2020, p.821, p.832 Signed-off-by: Serge Semin --- drivers/edac/synopsys_edac.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/edac/synopsys_edac.c b/drivers/edac/synopsys_edac.c index 90b57986a9b5..872ad9a164a7 100644 --- a/drivers/edac/synopsys_edac.c +++ b/drivers/edac/synopsys_edac.c @@ -23,9 +23,6 @@ #include "edac_module.h" -/* Number of cs_rows needed per memory controller */ -#define SNPS_EDAC_NR_CSROWS 1 - /* Number of channels per memory controller */ #define SNPS_EDAC_NR_CHANS 1 @@ -795,7 +792,7 @@ static void snps_handle_error(struct mem_ctl_info *mci, struct snps_ecc_status * edac_mc_handle_error(HW_EVENT_ERR_CORRECTED, mci, p->ce_cnt, PHYS_PFN(sys), offset_in_page(sys), - pinf->syndrome, 0, 0, -1, + pinf->syndrome, pinf->sdram.rank, 0, -1, priv->message, ""); } @@ -812,7 +809,7 @@ static void snps_handle_error(struct mem_ctl_info *mci, struct snps_ecc_status * edac_mc_handle_error(HW_EVENT_ERR_UNCORRECTED, mci, p->ue_cnt, PHYS_PFN(sys), offset_in_page(sys), - pinf->syndrome, 0, 0, -1, + pinf->syndrome, pinf->sdram.rank, 0, -1, priv->message, ""); } @@ -1411,10 +1408,7 @@ static u64 snps_get_sdram_size(struct snps_edac_priv *priv) size++; } - for (i = 0; i < DDR_MAX_RANK_WIDTH; i++) { - if (map->rank[i] != DDR_ADDRMAP_UNUSED) - size++; - } + /* Skip the ranks since the multi-rankness is determined by layer[0] */ return 1ULL << (size + priv->info.dq_width); } @@ -1468,7 +1462,7 @@ static struct mem_ctl_info *snps_mc_create(struct snps_edac_priv *priv) struct mem_ctl_info *mci; layers[0].type = EDAC_MC_LAYER_CHIP_SELECT; - layers[0].size = SNPS_EDAC_NR_CSROWS; + layers[0].size = priv->info.ranks; layers[0].is_virt_csrow = true; layers[1].type = EDAC_MC_LAYER_CHANNEL; layers[1].size = SNPS_EDAC_NR_CHANS; -- 2.35.1