Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp6176332rwn; Mon, 12 Sep 2022 23:21:40 -0700 (PDT) X-Google-Smtp-Source: AA6agR7qpOTabl7ZdQ4C88IiRXJDFjfJXP9PFsh8EPH7rLOWkPz7z6GNxmIztn223+CrI+Ap/wk8 X-Received: by 2002:a17:906:ef8c:b0:77c:7b35:8b04 with SMTP id ze12-20020a170906ef8c00b0077c7b358b04mr6879722ejb.573.1663050100369; Mon, 12 Sep 2022 23:21:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663050100; cv=none; d=google.com; s=arc-20160816; b=P6C0cXM/oAoNxGegpg14RDD40za4JMdSaPysVRVFwqc5uNcCeoVWeUO1zoM7oAIJ2G u9TLRoxLDlmWYgRKuFZuDAChs1c5duoH2/ze8aM00f1CNsxl9oapTfnZOOQvbRuc+qdP Xd75itOxna2Jr0t8ZO76E0AAxX1haMWIslBZSsZbggLyl9dSW/m8z+RjC6YD/mT84FAr NM+F6tgoV6SdaWxLiZKRuukfW8/hevpRHdOEghtYescByk5+zyhT7fG8uiwWQD1LE5w1 ciV06oYSM4fXa7CnBKcJz3kwf3FVWg2SClltIMaRpzPWHc2+wkM36iPcAF3qM163P7hG A1KA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=viUsGW+Zs7kQMJlix4q594CqGsU1OFW3HynVNHA2iG8=; b=pm/njnU6mWhh5QuRvHRONMzxmf3IkWamMXBt1Z+9og6KcmlZXnnNxTbkQPk+6slmlH xQcSCdQgHJ7jlvI7CuPC0ri4X5gjNTEzd4MC7i8PcC7O9TyNTJ32ZpHW0UQLBuN5cggq nCiQ9rEGbpHjkWvjNgwawD5aoe6SM7XHc03C7/VTsHG74geRrJZnmjg1KZoqlGoz/qp1 IRl0llcVPXfgg+oj1dqymG2elj195rZgkTeIl62kLj5hJ3YHzk9C+2eyNZiAFSj4JBQD /qnj32LO3qAUzfcTNI+7P+15gA5AlYLz8cCpFupIhzNIxN9Q5XKyQK5bhCrdSI3ITsIG M7gA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=bFFEcnl9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sb20-20020a1709076d9400b0077a6429787dsi6704692ejc.157.2022.09.12.23.21.14; Mon, 12 Sep 2022 23:21:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=bFFEcnl9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230165AbiIMGTG (ORCPT + 99 others); Tue, 13 Sep 2022 02:19:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229916AbiIMGSe (ORCPT ); Tue, 13 Sep 2022 02:18:34 -0400 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F84A56BA4 for ; Mon, 12 Sep 2022 23:18:33 -0700 (PDT) Received: by mail-pj1-x1030.google.com with SMTP id fs14so10250202pjb.5 for ; Mon, 12 Sep 2022 23:18:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date; bh=viUsGW+Zs7kQMJlix4q594CqGsU1OFW3HynVNHA2iG8=; b=bFFEcnl9GlVMuRvNsEeFKpPtnPkLtYPNOLwDpmNghQf1y4tyfewadzjyK2i2z30JdS 6uRB6cn7wK7cGWkU5WSDP2Zob0KONnKqSbcxE0cQCnXsBFhZdzm7M6Sbw4/BOMSZ5jXE dRBi1T0zQHsL4YI5RhEnOxgTGNyZPCmkq9yy+5fBuBurilD0eCeWCsVQnSlj2Eq05Scb 7s4i2Mvuct3albarrpaRaDtzwJNNaJw8THouke2Z5UUK2XxCn6CNUn6B5m5w5/kNmaSx 7FhRFVonvhpdTNfL70koPBwS3/VQ3yUQmN+vWEynUEhGr80etfTsYwuYjhKDc1BNI00E ZD7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date; bh=viUsGW+Zs7kQMJlix4q594CqGsU1OFW3HynVNHA2iG8=; b=t6WKchE6z9jymjbQem3cOBL76rCIrYWt9c/lsnCRVSZkMKAMYr9UyrC22/lomyrOUB YDZaw9mvOrleGEDzPqMIyqh2qIWD2hre/aRr3KCbtWRTehFOowzU+E1Li6tHxX/toElq s6UjaBnc6J3KlnovXpvL4POU/sbK2A3OQIRuC+RUG5jC05soMuPIlI9Z5VRNdUxSdsKi RgzYi9pAg+YX/9erPcloCxJkGvzXPcpHTc9tVRYScshMhkn0b68sffCjf5BEi0LL4gwr HLk1zWXZ4wwrdlXIoIaj5Z3X0EsCfnjbDMdiV5+bsm6ni2Rsu8xktMwZaD/JmbmX1oLH NCgg== X-Gm-Message-State: ACgBeo1qXEjdLsfmQFrWpS/ULWHkgD6oxkLYsBBqSqi93gck9io1TW71 uiimcok/sZeZm6heWf4J08N+Wg== X-Received: by 2002:a17:90b:33cf:b0:202:5183:c1ab with SMTP id lk15-20020a17090b33cf00b002025183c1abmr2236619pjb.117.1663049913123; Mon, 12 Sep 2022 23:18:33 -0700 (PDT) Received: from localhost.localdomain (59-124-168-89.hinet-ip.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id z11-20020a170902cccb00b00173cfaed233sm7296332ple.62.2022.09.12.23.18.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Sep 2022 23:18:32 -0700 (PDT) From: Zong Li To: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, palmer@dabbelt.com, paul.walmsley@sifive.com, aou@eecs.berkeley.edu, greentime.hu@sifive.com, conor.dooley@microchip.com, ben.dooks@sifive.com, bp@alien8.de, devicetree@vger.kernel.org, linux-riscv@lists.infradead.org, linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Zong Li Subject: [PATCH v5 3/7] soc: sifive: ccache: determine the cache level from dts Date: Tue, 13 Sep 2022 06:18:13 +0000 Message-Id: <20220913061817.22564-4-zong.li@sifive.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220913061817.22564-1-zong.li@sifive.com> References: <20220913061817.22564-1-zong.li@sifive.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Composable cache could be L2 or L3 cache, use 'cache-level' property of device node to determine the level. Signed-off-by: Zong Li Reviewed-by: Conor Dooley --- drivers/soc/sifive/sifive_ccache.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/soc/sifive/sifive_ccache.c b/drivers/soc/sifive/sifive_ccache.c index 949b824e89ad..b361b661ea09 100644 --- a/drivers/soc/sifive/sifive_ccache.c +++ b/drivers/soc/sifive/sifive_ccache.c @@ -38,6 +38,7 @@ static void __iomem *ccache_base; static int g_irq[SIFIVE_CCACHE_MAX_ECCINTR]; static struct riscv_cacheinfo_ops ccache_cache_ops; +static int level; enum { DIR_CORR = 0, @@ -144,7 +145,7 @@ static const struct attribute_group *ccache_get_priv_group(struct cacheinfo *this_leaf) { /* We want to use private group for composable cache only */ - if (this_leaf->level == 2) + if (this_leaf->level == level) return &priv_attr_group; else return NULL; @@ -215,6 +216,9 @@ static int __init sifive_ccache_init(void) if (!ccache_base) return -ENOMEM; + if (of_property_read_u32(np, "cache-level", &level)) + return -ENOENT; + intr_num = of_property_count_u32_elems(np, "interrupts"); if (!intr_num) { pr_err("CCACHE: no interrupts property\n"); -- 2.17.1