From patchwork Wed Sep 20 19:26:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 13393342 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 684EAC04FF3 for ; Wed, 20 Sep 2023 19:29:35 +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=Q1OyjdOJj+uPLAS56/22XguJBtNn2s9l3fnlcFOjQxE=; b=VDknBKSnaBW6sP Q8GPmUO/v+dJUKYq6fBQmYUTf3SOGI5eEPEHXE2p8ria2Hf63PcIOybo7wT2XSteXQon/1GmKsXyu xAE5Fc3NJW2XYJHhMlJOwMlojnTVwHMUocb+ZB7HLT59Ljvj6C/O38nyaPvBvJO03uo1WZISNy7fD o+GTwhZsfISzzuT1B84a7YOZfJiHINeFIl4zm/qo8cHZPbr5u7isFHDGTYdY5ikCaraJtef3U7H6H zRdA6es7mu7js7Gelq4pET3Y77XVq12CGgP6ebBQ8Q2q9UBUWt5+U+uU/1FgWAlIHbE6iQDZ6nOBN YiD50CVV2+QYojx5ezJw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qj2so-0040XA-1X; Wed, 20 Sep 2023 19:29:10 +0000 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qj2sX-0040Ig-17 for linux-arm-kernel@lists.infradead.org; Wed, 20 Sep 2023 19:28:54 +0000 Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-50300cb4776so366412e87.3 for ; Wed, 20 Sep 2023 12:28:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695238130; x=1695842930; 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=QqkMxqOHncqsMYhQRlBDL7MG22B9ye3F7LSOor6Fxdc=; b=aFvA4QyAGEfD9nw6TrOa2Fwrg05ixI6DlUUx91futu2KEHdsaRub4vwPagfNqrmQuL +WZMLTjBglSfhXbUTMRmICFUJR8WYEuff/UZO6pPUPio0tMSBhmnMoQ2bOLL8Vu048pV Di7CW0Wisj5aYxHfXhDqurQiY0tEnegzQmklRPQZ2+4b9YVblcrXlcREhf/9jPGUON2f 2Nt1RGjYdaf8UG2Z5RmUyFwhhSPs8QRhwpwLGepkR0vDpvKHd+MccK41cpHbnlgggZL6 X3zTUR4yNYxcOMev3+Yo1ZeFygOslyaTL0edx0FkOk0IcOCJ8s05+oOHAESZuS6E2+8y KJmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695238130; x=1695842930; 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=QqkMxqOHncqsMYhQRlBDL7MG22B9ye3F7LSOor6Fxdc=; b=EzHJBH6S20qACG5aYYEj6kofRIa19tf02SN4Hh3WPCDKNK7OiYEV+O+0UbVdZvkAXk ooTggaLjr52KDhBbfTp11FWrykukW/LGt08d2gEGjYVHuv6JMnb3ibDBsB2gTg8IjWMq J5xYxcRxTW2Jde3bNs8io41JjlcZICHHx3eD7Y6BJ02yJBCMYYAS1tTM+izBCrHlAsvm HyjKz6IeoT3e1gaYlPUqudZ8yf5IeBC+LFh9KLKqu5zA+69wiU1JYhcqrz3RdWEfWB9k iRJL+OG5yiv7XsY9zNZ5GMs1zsetpip/xPhSi4hZNc+5eOgtzXS+2ulv78BvKKnsWbSb rwFQ== X-Gm-Message-State: AOJu0YxjGl1q8HowEoJ6iZ1E0HYOJaBpq2MBhTmbjfO/2vEQyelyZsXI cZlsdVHMs2W1/knPJJCbvq4= X-Google-Smtp-Source: AGHT+IHwKIWEU16ms/otWDq2b8ELHaN+mH3xTI3PC2c/Z46prfo2moy4ZDTclGHfvjbZhTpn7gKqlQ== X-Received: by 2002:a05:6512:2813:b0:503:3803:9e99 with SMTP id cf19-20020a056512281300b0050338039e99mr4239358lfb.15.1695238129974; Wed, 20 Sep 2023 12:28:49 -0700 (PDT) Received: from localhost ([178.176.86.191]) by smtp.gmail.com with ESMTPSA id r6-20020a19ac46000000b00502e01d1383sm2805899lfc.27.2023.09.20.12.28.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Sep 2023 12:28:49 -0700 (PDT) From: Serge Semin To: Michal Simek , Alexander Stein , Borislav Petkov , Tony Luck , James Morse , Mauro Carvalho Chehab , Robert Richter Cc: Serge Semin , Punnaiah Choudary Kalluri , Dinh Nguyen , Arnd Bergmann , Greg Kroah-Hartman , linux-arm-kernel@lists.infradead.org, linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 09/18] EDAC/synopsys: Set actual DIMM ECC errors grain Date: Wed, 20 Sep 2023 22:26:54 +0300 Message-ID: <20230920192806.29960-10-fancer.lancer@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230920192806.29960-1-fancer.lancer@gmail.com> References: <20230920192806.29960-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_122853_397891_C931D3C1 X-CRM114-Status: GOOD ( 17.17 ) 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 It was wrong to set the DIMM errors grain parameter to just 1 byte because DW uMCTL2 DDRC calculates ECC for each SDRAM word and passes it as an additional byte of data to the memory chips. SDRAM word is the actual DQ-bus width determined by the DQ-width set during the IP-core synthesize and the DQ-bus mode (part of the DQ-bus actually used to get data from the memory chips) selected during the DDR controller initial setup procedure. Thus set the MCI DIMMs grain based on these parameters determined during the DW uMCTL2 DDRC config getting procedure. Signed-off-by: Serge Semin --- drivers/edac/synopsys_edac.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/edac/synopsys_edac.c b/drivers/edac/synopsys_edac.c index e6288e135480..e10778cead63 100644 --- a/drivers/edac/synopsys_edac.c +++ b/drivers/edac/synopsys_edac.c @@ -26,9 +26,6 @@ /* Number of channels per memory controller */ #define SNPS_EDAC_NR_CHANS 1 -/* Granularity of reported error in bytes */ -#define SNPS_EDAC_ERR_GRAIN 1 - #define SNPS_EDAC_MSG_SIZE 256 #define SNPS_EDAC_MOD_STRING "snps_edac" @@ -736,9 +733,12 @@ static void snps_init_csrows(struct mem_ctl_info *mci) struct snps_edac_priv *priv = mci->pvt_info; struct csrow_info *csi; struct dimm_info *dimm; - u32 size, row; + u32 size, row, width; int j; + /* Actual SDRAM-word width for which ECC is calculated */ + width = 1U << (priv->info.dq_width - priv->info.dq_mode); + for (row = 0; row < mci->nr_csrows; row++) { csi = mci->csrows[row]; size = snps_get_memsize(); @@ -748,7 +748,7 @@ static void snps_init_csrows(struct mem_ctl_info *mci) dimm->edac_mode = EDAC_SECDED; dimm->mtype = priv->info.sdram_mode; dimm->nr_pages = (size >> PAGE_SHIFT) / csi->nr_channels; - dimm->grain = SNPS_EDAC_ERR_GRAIN; + dimm->grain = width; dimm->dtype = priv->info.dev_cfg; } }