Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp4134988iog; Tue, 21 Jun 2022 12:48:52 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tRmqRSYyVgDpZmVDmXTs48arCpJPMzQO1wElwleTurvh7oOvjZkHNGoqQVA94TMBIO7KOd X-Received: by 2002:a17:902:b18d:b0:167:86f2:88c7 with SMTP id s13-20020a170902b18d00b0016786f288c7mr30493045plr.103.1655840932703; Tue, 21 Jun 2022 12:48:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655840932; cv=none; d=google.com; s=arc-20160816; b=e1G1obVa9Bd4m091OMvCf82Dw/aFLZA0/r3vPpVmBsOjUFK5zzApIaXKz0SCPrsg24 gf19FvuNxE6Zx8+V4zQ2iBdFfMkuToo1aD8XGs7WO2Faor39hMsG2Ux2qKUBDKzHdp03 rPdyXXB40KZpptEX8QBjvgaqXUHT4tPIVZEQT89ZgwuOStaiKyVFXOZyRO3P1m4W0noy yXGRwSXXG7ImzohaTPWV5IngqPFkzZw5I19G/roZNv3kE3bS+i6IbZe+659l6lhGDXMn FrXJYjSPAyzzHBAztEcLuBPRJxbZpZHYL3ZKr/JTYEcWJIlJA30G8L+0vuvt7/A//tmL xDNQ== 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=OVmXu393+a858tToCUhexQKZciSOCW0Q2VQG/ICHCQc=; b=Us5+8b/mK1eX2tVMylG8TBHgHVostnZTjMiKiN3bzmYt0eeNxTnyDVM7bu9ltnzjny ya8kNeAAvZ5vunbETSkR7SsNqRfGuFtN9JTjrAFBq6tGVmMlhxA0rp/ZFmTahgV3+6HP VyXrspusWlb0ms/aMKmlaGCEISF6fRDzMFPi+sZW9BB3/Sgg7bWMRVizs8nFedfK8o/B kpZfNYUiVA/Z9N68cZhXoBIDrB2Dnc2czr2ElhZbJ0xI87yfWnly+ppIFy46C2Zo+zsK jo5CQ/zsY6KwXMRqgLxr9nZDQoIknjvOn8aZDvVlODKiJhkL6GnGMASKtXcK02isrNWl OV1A== 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 j187-20020a636ec4000000b003c6709779a9si20044276pgc.295.2022.06.21.12.48.39; Tue, 21 Jun 2022 12:48:52 -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 S1352341AbiFUTVY (ORCPT + 99 others); Tue, 21 Jun 2022 15:21:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236144AbiFUTVD (ORCPT ); Tue, 21 Jun 2022 15:21:03 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D7CFB1163 for ; Tue, 21 Jun 2022 12:21:02 -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 CFBEA1688; Tue, 21 Jun 2022 12:21:02 -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 C66003F792; Tue, 21 Jun 2022 12:21:00 -0700 (PDT) From: Sudeep Holla To: linux-kernel@vger.kernel.org, Greg KH Cc: Sudeep Holla , 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 v4 08/20] arch_topology: Add support to parse and detect cache attributes Date: Tue, 21 Jun 2022 20:20:22 +0100 Message-Id: <20220621192034.3332546-9-sudeep.holla@arm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621192034.3332546-1-sudeep.holla@arm.com> References: <20220621192034.3332546-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. 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