From patchwork Wed Sep 20 19:56:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 13393389 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A71EAC04FFA for ; Wed, 20 Sep 2023 19:58:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=db5NW7Yhkkw0eu7KIaZ892krkE18JTVlXO4R0lxdtDY=; b=zACzpJLsF32EpX PyiCx1qExTTAa7lR/xoc0YZOhfrin37+DL9E+pZ0Vf2OqAxgsHF1pkk97Fe88JE6+ygnBcvN1sedk cSHCmee1LZt61tLOKOKBGHIEMfOs0GYw1A3scqqYMCtZAtU4oKOsR/LRkoCI044HjsD+sVKzVVDQ/ 7h8L+NWFtcLNUnVEGLukJXOBJII6EDazQ7Biv53k7uk4/oNonYMmfN71MwsTTa8Wzg1FF5qUUh/R+ DGYxcdVPwvEanUKGNTDA++JdhK02ODYE65OZmmyQ0Fcty3WK6kOgk4TyuHL0iZSgodASq4UGSgEQB hfmKs6EHCnn/dK+DlSZg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qj3KY-0044Vc-22; Wed, 20 Sep 2023 19:57:50 +0000 Received: from mail-lj1-x230.google.com ([2a00:1450:4864:20::230]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qj3KM-0044Q5-0k for linux-arm-kernel@lists.infradead.org; Wed, 20 Sep 2023 19:57:39 +0000 Received: by mail-lj1-x230.google.com with SMTP id 38308e7fff4ca-2bb9a063f26so2806321fa.2 for ; Wed, 20 Sep 2023 12:57:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695239856; x=1695844656; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dp2D4QZmdlsQyBLWq2sQtKZA/5LWMqfQ8G/Yqqs3zwQ=; b=cgWGf2YYJk75+Q6zNJinRGHqOvmx3p0Fh7B0fbfezzxTcLYXMkDQ8T+/wctyHBRsUv YbqSUyo5LZZ5ZVHoKSfIurt3SvcK52HVvOGWT6eNprlsFN24TTDZMRcHLdlzs1HJDGYj bd1BbawYNfnNRZ6VrBN4829sL5MYRpWMgobmMQQlmON5F97FISWTN3H3eA7x2IRSq8m0 KCuX8cxXH8B0yeNFa/o39cZi7kg3o4O3eQ4CFiTSBKn7zpZMLeUiZ21jYCaDiDLf8alO is+IvFNPxuD+XDXd4VaTHUpjJI+/zg+Njdppyp7UwAaY0OGYO06Ve3QPCREPd8V2NX63 Kslg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695239856; x=1695844656; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dp2D4QZmdlsQyBLWq2sQtKZA/5LWMqfQ8G/Yqqs3zwQ=; b=UdPulBDwTVTy2379mr1S1cvde2HcQiAzctCn04Z24kppAoK4xKW/AeZletEzYf2xqu 8bel6oVHwZvS2ukeSglHyDgmmeqeGWk1ZSaprFfXhmis3i0LRJXXYP78nWTV9Q8KSbbn BHntofW+pm/xCQHvO/Qb/MYTiTsL54t0sPfMTVq09TNk1u3DniDWm5cDwwdKAqaYWOBC LFhhZ6JWl+iHJ6Hv2l3ykhUGhfIJWod6iJITQOHPA6X774i2f0XB6uSR+2K08/tJIB/7 zirHJ3BoH1ZAqh2uxA7TPleHgnIJCK7/BipjISvEMJU2FF0wM98Bpw7UWPf0pdPSLSUA f6Dg== X-Gm-Message-State: AOJu0YwxayTO5ttTEoAEersD+yw8T9d7t6cZoG3U/bcN3nUea+rQiGAw Xuk2Z2AQRs8bxSm15QGqYNI= X-Google-Smtp-Source: AGHT+IFkjCYXba43Sgzfkts2IbGRIloyX7PWaiJZTCw/clVsATFqphseD4OublnUiq477tgxyf4xrQ== X-Received: by 2002:a2e:9cd5:0:b0:2b9:dd5d:5d0c with SMTP id g21-20020a2e9cd5000000b002b9dd5d5d0cmr2801973ljj.52.1695239856352; Wed, 20 Sep 2023 12:57:36 -0700 (PDT) Received: from localhost ([85.26.234.143]) by smtp.gmail.com with ESMTPSA id q4-20020a2eb4a4000000b002c12630e4d3sm245602ljm.127.2023.09.20.12.57.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Sep 2023 12:57:35 -0700 (PDT) From: Serge Semin To: Michal Simek , Alexander Stein , Borislav Petkov , Tony Luck , James Morse , Mauro Carvalho Chehab , Robert Richter , Rob Herring , Krzysztof Kozlowski Cc: Serge Semin , Punnaiah Choudary Kalluri , Dinh Nguyen , Arnd Bergmann , Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 03/13] EDAC/synopsys: Add multi-ranked memory support Date: Wed, 20 Sep 2023 22:56:34 +0300 Message-ID: <20230920195720.32047-4-fancer.lancer@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230920195720.32047-1-fancer.lancer@gmail.com> References: <20230920195720.32047-1-fancer.lancer@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230920_125738_265621_F6459A9A X-CRM114-Status: GOOD ( 17.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 the driver now supports detecting the number of ranks use it 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 since the multi-rankness is abstracted out on the EDAC-core layer[0] level, drop the ranks from out of the total memory size calculation. [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 | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/edac/synopsys_edac.c b/drivers/edac/synopsys_edac.c index 9a621b7a256d..001553f3849a 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 @@ -799,7 +796,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, ""); } @@ -816,7 +813,8 @@ 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), - 0, 0, 0, -1, priv->message, ""); + 0, pinf->sdram.rank, 0, -1, + priv->message, ""); } memset(p, 0, sizeof(*p)); @@ -1416,10 +1414,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); } @@ -1473,7 +1468,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;