Received: by 2002:ac0:de83:0:0:0:0:0 with SMTP id b3csp1456686imk; Mon, 4 Jul 2022 03:31:44 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u3OvX1K7LcYO7OEVsvzukTkKbtHJeVlysEzFSLotr3rxtI22drD8T/I87MtpZjna15/QDd X-Received: by 2002:a17:903:2305:b0:16a:73ce:90ca with SMTP id d5-20020a170903230500b0016a73ce90camr34460013plh.20.1656930704637; Mon, 04 Jul 2022 03:31:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656930704; cv=none; d=google.com; s=arc-20160816; b=Xll5BND00kyIX57HFv9jD9biAkxR8Hx5t6UTXWBfs9909TZ9Xmg47RJ2eZFVkgy9gq AwPx2pc0H/N6UajGEfgUnAuudNxlUbe+ov4Qscy62Lg26hOtv5CW+w3e6GB4di+SYlK/ JHbaxjrv7vpOpL9sR0M6aiiwtbxEfvlnPurG3qTBmyP16GLY+NMTbkif52N+JhiQd95L pnY0a1CtwXt8RDTpuaTtWA4nVoo8CL5uxtDoBcFlS9RdEAAAXsSxMQtqgTENuJjynmpf 4lSLObPKurerX5FDdRPvO4Q4haDFnvNEGLKrk2FmMXK3huMzWHJmlOiJjtNt2VzHMPF6 sN+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=rdDpk6HqImWLQbAdSGyfBXHwTZfrd8VsBCX7yD6k2aY=; b=yMR6TT/t5WKDU2VFK/e9I2AjSQnRdCgHRRl9dBPucU678hDa5b0M9++7hV534kxUyt 4ta/1253hnv+lCcj5CHpa07hwx83IY8Z/lpNdyM7hJs84dzlMQGDUuCobyhsPT2fcf36 EF/90W6fhDPjMe0rU6IJEW+4vIls3kuM9YIF/0C9Yt3QFhbKaZ75BmWKvhjLwZdc5qwT EpvChV7ioXHzukPdCO7xmBJq/sfOK0jSY8bzbID/wFh3TvgQI4xYJeDbz3zSQM41Saz6 4hNd1u5v1yJF1ZMKIT0SbLwJeIdbtllWgBrLtFa/670SA9yl2XNCcL1nwofjtnK/1Rjz 0GYQ== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id md14-20020a17090b23ce00b001ecdf878379si13223541pjb.150.2022.07.04.03.31.32; Mon, 04 Jul 2022 03:31:44 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234394AbiGDKR2 (ORCPT + 99 others); Mon, 4 Jul 2022 06:17:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233303AbiGDKQe (ORCPT ); Mon, 4 Jul 2022 06:16:34 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id ED747DFA9 for ; Mon, 4 Jul 2022 03:16:33 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 11E5C23A; Mon, 4 Jul 2022 03:16:34 -0700 (PDT) Received: from usa.arm.com (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id DB9EC3F792; Mon, 4 Jul 2022 03:16:31 -0700 (PDT) From: Sudeep Holla To: linux-kernel@vger.kernel.org, Greg Kroah-Hartman Cc: Sudeep Holla , conor.dooley@microchip.com, valentina.fernandezalanis@microchip.com, Vincent Guittot , Dietmar Eggemann , Qing Wang , Rob Herring , "Rafael J . Wysocki" , Ionela Voinescu , Pierre Gondois , linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, Gavin Shan Subject: [PATCH v6 09/21] arch_topology: Add support to parse and detect cache attributes Date: Mon, 4 Jul 2022 11:15:53 +0100 Message-Id: <20220704101605.1318280-10-sudeep.holla@arm.com> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220704101605.1318280-1-sudeep.holla@arm.com> References: <20220704101605.1318280-1-sudeep.holla@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_NONE,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 Currently ACPI populates just the minimum information about the last level cache from PPTT in order to feed the same to build sched_domains. Similar support for DT platforms is not present. In order to enable the same, the entire cache hierarchy information can be built as part of CPU topoplogy parsing both on ACPI and DT platforms. Note that this change builds the cacheinfo early even on ACPI systems, but the current mechanism of building llc_sibling mask remains unchanged. Tested-by: Ionela Voinescu Reviewed-by: Gavin Shan Signed-off-by: Sudeep Holla --- drivers/base/arch_topology.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index 579c851a2bd7..e2f7d9ea558e 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -7,6 +7,7 @@ */ #include +#include #include #include #include @@ -780,15 +781,28 @@ __weak int __init parse_acpi_topology(void) #if defined(CONFIG_ARM64) || defined(CONFIG_RISCV) void __init init_cpu_topology(void) { + int ret, cpu; + reset_cpu_topology(); + ret = parse_acpi_topology(); + if (!ret) + ret = of_have_populated_dt() && parse_dt_topology(); - /* - * Discard anything that was parsed if we hit an error so we - * don't use partial information. - */ - if (parse_acpi_topology()) - reset_cpu_topology(); - else if (of_have_populated_dt() && parse_dt_topology()) + if (ret) { + /* + * Discard anything that was parsed if we hit an error so we + * don't use partial information. + */ reset_cpu_topology(); + return; + } + + for_each_possible_cpu(cpu) { + ret = detect_cache_attributes(cpu); + if (ret) { + pr_info("Early cacheinfo failed, ret = %d\n", ret); + break; + } + } } #endif -- 2.37.0