Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3137696iog; Mon, 27 Jun 2022 09:54:28 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v2rN4Io7FIa3CdfX3fZVM1RaWQvgZlDlQJQQP8ca4BtkpZgafnyjImXc1nObE6zWN41sSR X-Received: by 2002:aa7:d685:0:b0:435:7910:f110 with SMTP id d5-20020aa7d685000000b004357910f110mr17416567edr.247.1656348868511; Mon, 27 Jun 2022 09:54:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656348868; cv=none; d=google.com; s=arc-20160816; b=WFZXvIViALRtkW2htImOkqMylf1cJZSHMR95yc8hWj6Wo3LGgPJ/I+BH/MT2y123Zs AXE2QAPYAgJrHTnK+e/0ksnzFKCPFoEImF2AOBukrAyN/sZQVd1FJnbXn0/P3vtPIFCf m3MXyD30QAl5QiOliVl7BiTE4muk8o0IfEdcgIpaJCfJnpMQ4DSNtSEOMggFRA4DRP+3 zUs7L/JJ/P4L6DlQYEaefrQ54ZpkpIHR13bbkyd9Mq5ZMJNn5ocZM+AvJl4Is2IScwzm DdC8MPLOKyueXDtrE1UK3IGTVjAIiSA4m/U9seNhSJE8N9RysPfu7A924Ds1ASIc8+6M f0vA== 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=+6/U2IUJQqzAxLxTkp8AXO+a4YRUk2F0fX7hpLxh5hM=; b=P16I3Ioqk37bAtItvYsk5v3GTJnuGcEtJcpC8vqHTXiyyp5eSelvx9CGNO7tHykOHL oZLo4dJiWU8ROFH3HCw5mBS1gIy2ycWV2x1adQr7hkDmRtOzxfEfFip6VrPk68q/JMFR wbxRWibk7mDOBOnb0k2NHcbFZ/zFSxLP786r6l4lRDJeDUE6eWIBKSeFK4Kore8fH1R7 9JxfyCM/gfMtU0bjqj5XHzpzjdLPewfDwCVYOSOq4ESSTb8s985cJeMULTmdbBsbFBaU iR685GaV+VD0Djkb2WersZQ4EBetooaErkkDg8xzZwYgnG54TvVvbDO+doSb2KU5uEaw UKmQ== 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 z4-20020a50cd04000000b00435de3b7fc1si13135397edi.604.2022.06.27.09.54.03; Mon, 27 Jun 2022 09:54:28 -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 S239613AbiF0Qvi (ORCPT + 99 others); Mon, 27 Jun 2022 12:51:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239414AbiF0QvU (ORCPT ); Mon, 27 Jun 2022 12:51:20 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id AF7C011462 for ; Mon, 27 Jun 2022 09:51:13 -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 B41E9175A; Mon, 27 Jun 2022 09:51:13 -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 B867B3F792; Mon, 27 Jun 2022 09:51:11 -0700 (PDT) From: Sudeep Holla To: linux-kernel@vger.kernel.org Cc: Sudeep Holla , Greg Kroah-Hartman , Atish Patra , Atish Patra , 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 v5 08/19] arch_topology: Add support to parse and detect cache attributes Date: Mon, 27 Jun 2022 17:50:36 +0100 Message-Id: <20220627165047.336669-9-sudeep.holla@arm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220627165047.336669-1-sudeep.holla@arm.com> References: <20220627165047.336669-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. Link: https://lore.kernel.org/r/20220621192034.3332546-9-sudeep.holla@arm.com Tested-by: Ionela Voinescu Reviewed-by: Gavin Shan Signed-off-by: Sudeep Holla --- drivers/base/arch_topology.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index 579c851a2bd7..23cb52180ce3 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,23 @@ __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) + detect_cache_attributes(cpu); } #endif -- 2.36.1