From patchwork Mon Aug 22 19:14:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 12951298 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 8350DC28D13 for ; Mon, 22 Aug 2022 19:37:50 +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=vQ5ehw2aq+wdk7ub7Wpw9ojIoAAVQM45RWlFeIfw9kk=; b=SdylzpaTX/9yFo ENGAUOKN46cjsZ/N8iP9ehyrJHz0clO2orQj7r8camKNeANdZI7Eg4QoNm4gNG6qhUBz36Eun0tQ5 3Vs7lPAEDN1sLRtOMvZRWvHtH/Kph5h4WWj3lhX6i899neSLRr0WYHKzXdbmPGyGMP341e28Qm63E UHyx9D3cTYsec/gcKG/HHFwej5rQQiPCxYF54iRyW7Cwjb+mPH4QBWw0kXqGLkQ05dw69MSO5/shL eYdWsWWqfYCuEMt2pHGtfNo7Y9w4yyBqQG8O7QpKE6BRd5/5NEhFwtA6JQ5yhOEb6LIy1y5LOPuAU L67SJQbHjEAK8Lb3HsNw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oQDDr-00E7I0-Vz; Mon, 22 Aug 2022 19:36:32 +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 1oQCsp-00Dvpp-DA for linux-arm-kernel@lists.infradead.org; Mon, 22 Aug 2022 19:14:50 +0000 Received: from mail (mail.baikal.int [192.168.51.25]) by mail.baikalelectronics.com (Postfix) with ESMTP id 9B660DAA; Mon, 22 Aug 2022 22:17:48 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.baikalelectronics.com 9B660DAA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baikalelectronics.ru; s=mail; t=1661195868; bh=S4Cpg3F9AoedZ1cfMlJGVURz8OADsydtqtvGr0KhezI=; h=From:To:CC:Subject:Date:In-Reply-To:References:From; b=h+bT8RkjDOm7fmyJhnYYUGLPCtCDoa7TYf8uXnrCp8tKFOGDUSFS9cGpjin6WzVjl evjrlOYibix15LOovSQ6iaKF4gySj8Y9b8Pm972Cz3oGuCKlxC3bKqx2xM3iOifoMx YnLmymo6T7Z7n/dkdrGgao3AeCME0W5sTBB/H/pI= 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:14:34 +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 08/18] EDAC/synopsys: Parse ADDRMAP[0] CSR for multi-ranks case only Date: Mon, 22 Aug 2022 22:14:17 +0300 Message-ID: <20220822191427.27969-9-Sergey.Semin@baikalelectronics.ru> In-Reply-To: <20220822191427.27969-1-Sergey.Semin@baikalelectronics.ru> References: <20220822191427.27969-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-20220822_121448_561025_A8937434 X-CRM114-Status: GOOD ( 12.73 ) 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 998600670c75..e7f8d448850b 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); + } } /**