From patchwork Sat Sep 10 19:49:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 12972679 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 47D57ECAAD3 for ; Sat, 10 Sep 2022 20:04:36 +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=L/WcDsD0kaF+m08FyzHrO5WLxD1sgfaZ5W+xPptCKGc=; b=l4kjd0sgwcWTlX EWLwoQQ/SJVGwsFDvTkD7z3/w2hdcjFOMGsvJUwxAOVRRFh74++zWO4jjM/tkSXQBvJqkudLX/Q/7 foqK0w82mrn9vJZnjs+vfbsPDBeVTGfXexvCMD6wY4hbmCw4UTDNWO/1mI2T805fsSLeH53Lr/OlO uvVXHtBpiB7QdYsSsni7EwSPFUb1VfbeTOuT3ByWwQGUmc8UgZL2l/0pl+DQ5bk0ZXp1cG9Ee6c1d OloCN/EzYTWGKWgR6gzls9gCXTlLTZLLdPO84K78/d+WLGNhusdXGFUsxKltUAQzltZJfltVnCV0B hyUOUMwOnlgkMSe7Wogg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oX6hM-00Cr13-D4; Sat, 10 Sep 2022 20:03:29 +0000 Received: from mail.baikalelectronics.com ([87.245.175.230]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oX6Uq-00CjJX-QK for linux-arm-kernel@lists.infradead.org; Sat, 10 Sep 2022 19:50:35 +0000 Received: from mail (mail.baikal.int [192.168.51.25]) by mail.baikalelectronics.com (Postfix) with ESMTP id 91C9ADBC; Sat, 10 Sep 2022 22:54:14 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.baikalelectronics.com 91C9ADBC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baikalelectronics.ru; s=mail; t=1662839654; bh=xHi7GUfEd6nv1WHmtizNiFU4A+I/4c6IDL4r1ap7+HA=; h=From:To:CC:Subject:Date:In-Reply-To:References:From; b=nfBwSNMZfkeO7Em0VU9yHrgneUfm22kl4/2w/jYLNOsSdubwhxlAeHbS0B3+ij0U0 tmqF1CiHqdF8BWSGP1yax9e2Cc4qWkf9CaHaC9sv2oHmkZKJMZhGEBa4tjsb+zq6ZO j5acjRolm3DTVwKOgazf2Opyl6aiARc6rzdIFRMo= Received: from localhost (192.168.168.10) by mail (192.168.51.25) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Sat, 10 Sep 2022 22:50:23 +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 , , , Subject: [PATCH RESEND v2 08/18] EDAC/synopsys: Parse ADDRMAP[0] CSR for multi-ranks case only Date: Sat, 10 Sep 2022 22:49:57 +0300 Message-ID: <20220910195007.11027-9-Sergey.Semin@baikalelectronics.ru> In-Reply-To: <20220910195007.11027-1-Sergey.Semin@baikalelectronics.ru> References: <20220910195007.11027-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220910_125033_127580_7C772C02 X-CRM114-Status: GOOD ( 12.29 ) 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 The ADDRMAP[0] CSR contains the SDRAM Rank bits mapping. Obviously it's applicable for the multi-ranked memory only. If either the attached memory isn't multi-ranked or the controller simply doesn't support the multi-rank memory, parsing the ADDRMAP[0] CSR will be not just pointless, but in the later case erroneous since the CSR may contain garbage data. So make sure the ADDRMAP[0] register is only parsed if the multi-ranked memory setup has been detected. Signed-off-by: Serge Semin --- drivers/edac/synopsys_edac.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/edac/synopsys_edac.c b/drivers/edac/synopsys_edac.c index a55ae7ff931c..87acb683ab5c 100644 --- a/drivers/edac/synopsys_edac.c +++ b/drivers/edac/synopsys_edac.c @@ -1143,9 +1143,12 @@ static void snps_setup_bg_address_map(struct snps_edac_priv *priv, u32 *addrmap) static void snps_setup_rank_address_map(struct snps_edac_priv *priv, u32 *addrmap) { - priv->rank_shift[0] = ((addrmap[0] & RANK_MAX_VAL_MASK) == - RANK_MAX_VAL_MASK) ? 0 : ((addrmap[0] & - RANK_MAX_VAL_MASK) + RANK_B0_BASE); + /* Ranks mapping is unavailable for the single-ranked memory */ + if (priv->info.ranks > 1) { + priv->rank_shift[0] = ((addrmap[0] & RANK_MAX_VAL_MASK) == + RANK_MAX_VAL_MASK) ? 0 : ((addrmap[0] & + RANK_MAX_VAL_MASK) + RANK_B0_BASE); + } } /**