From patchwork Wed Sep 20 19:26:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 13393343 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 67A6CC04FF1 for ; Wed, 20 Sep 2023 19:29: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=2asz8jl2tLEw+HcMjcXWJ+NEQqrpkPlwhA/rfBICZMY=; b=3Rj0fBcSwxR4gu b4bGHWDVACaLz2mqqbxnAJBxQPAnb01E1b2fNizHeHz/hbe1jiDtMnvQpKIUA123SjwiqtHDExL19 QeDVqIkTf+6dDzZ8ziZFLpiy9ZJ+JRMJUAzbMd2eKv4ZomsQ/lB1lPIBVAtr+fPpsbfXrpHM5PYEh 7MV5QXz9Fe8M0Egp9sZGPXqdcmF6QVYDXVlfwk5pUHXkcF/gDxhQ6AjsyMV/Px5VgDqIPikv4FeWc Rys1mqNvkvwMc066XSQXO0NlqcKD0814PxbP0pu1GrLUTxg9k4zKuQAJuUJ/EvtYat+92IMpD4qH/ 6tnSgNzoBpVXdmIM4mMg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qj2sn-0040WX-1k; Wed, 20 Sep 2023 19:29:09 +0000 Received: from mail-lj1-x236.google.com ([2a00:1450:4864:20::236]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qj2sS-0040Gd-38 for linux-arm-kernel@lists.infradead.org; Wed, 20 Sep 2023 19:28:50 +0000 Received: by mail-lj1-x236.google.com with SMTP id 38308e7fff4ca-2b962c226ceso2464941fa.3 for ; Wed, 20 Sep 2023 12:28:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695238127; x=1695842927; 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=TA5e5G5EPvnnL49j/b8nNcZDnZYJMuuDQgONa21D59s=; b=I2Vocha2UfTFy/4Qmx5x0ezy0nTCRixdaax10UxKt1jgit6IYVRod2ePTujkGAMShL 9dlySXnAsCEOh/44SbZgjFoTUkNAha/ohjZHubEn+rCib0AWrwjkziQxdYyf2Ex9yF3v YHeNrTxQ8Z1qs3t3pInbBgblnZA9ubmvkAcVeXlqDoL0doCstIBuR4EQIAp3kezW2sRg 6ZpBsM+HtVe4Ar5eSBTFhA5Q6LVhfW9QCqm5CEy5tBhqnKVEy1RbxkfpPClZQ5pfx89/ UldIEgPkKoKbRD3OY07U8E6pYkrPLusGpHDi1WVW7HuZyxnv61pTuS1fucFoQvdbPo3J 3ihQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695238127; x=1695842927; 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=TA5e5G5EPvnnL49j/b8nNcZDnZYJMuuDQgONa21D59s=; b=r+3kmyxVDJOxPak1G9T5OrWbGnuagSwnRMjgnixgFIQ2wPTfMv+OEHqpLbEYRKxBDB M+bGfl91vkf7dSpA33uO0//ZCat/CZE4tibj3y/2VgcSOQupT3qwYgaLJpdf9hDGHkIW cwgPTg7/tFrdq054RbcNLdk0u+PaHLNmvpSKHjjANJkeAjrDOmOJtBq9DZyepI0DnvQ8 yRXgdjmjpp7UFozEIOzoaUfAjJSxEVjJWOfSV0aGJ71bZsGNJ64GxDz08a9YbWNpEhvj /B5I9bviQyh1qlxPtJlnqbkz1EHvp5EoLgfZzNkdvNmRm5YFv3eHmUUaZkaCeGeTuYd9 VG3Q== X-Gm-Message-State: AOJu0YyMvLqwTlzH0LUX1ibigW37nv1qtOXTpsu+S0tflUmlO2q/Ui5n yNT/QnnoIuEU1fTA71fs8O4= X-Google-Smtp-Source: AGHT+IFZDSF5zoq/W8jvFfDRKCF1KokOy7dJYucnqgvUrulEP8IaDlgpjwEqAHOhtU+vPGMtXh3DmA== X-Received: by 2002:a05:6512:104f:b0:503:364e:96ce with SMTP id c15-20020a056512104f00b00503364e96cemr3532656lfb.29.1695238126987; Wed, 20 Sep 2023 12:28:46 -0700 (PDT) Received: from localhost ([178.176.85.138]) by smtp.gmail.com with ESMTPSA id j26-20020a19f51a000000b004ff973cb14esm739436lfb.108.2023.09.20.12.28.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Sep 2023 12:28:45 -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 08/18] EDAC/synopsys: Parse ADDRMAP[0] CSR for multi-ranks case only Date: Wed, 20 Sep 2023 22:26:53 +0300 Message-ID: <20230920192806.29960-9-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_122849_096362_E20112B0 X-CRM114-Status: GOOD ( 15.85 ) 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 (and memory channel mapping but it's irrelevant in this case). Obviously they are 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 fields will contain zeros which will be perceived by the mapping detection procedure as a valid value. So the mapping will get to be invalid. Thus make sure the ADDRMAP[0] register is parsed only if a 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 5a06038aedcb..e6288e135480 100644 --- a/drivers/edac/synopsys_edac.c +++ b/drivers/edac/synopsys_edac.c @@ -1146,9 +1146,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); + } } /**