From patchwork Wed Apr 25 23:31:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Linton X-Patchwork-Id: 134392 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp1533738lji; Wed, 25 Apr 2018 17:27:44 -0700 (PDT) X-Google-Smtp-Source: AIpwx48LYnaUgEUp+XqqMDRIIiAFDJnoWj+6+vCeXBkpA9gJTrpCC6ZZ2ygzecH7hLxfw0+971Ei X-Received: by 10.99.112.82 with SMTP id a18mr16099429pgn.148.1524702464067; Wed, 25 Apr 2018 17:27:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524702464; cv=none; d=google.com; s=arc-20160816; b=EtH5GHOlLt6qYClnLxoLU+6w8INSY4tSGftfXzm9Xv3cpFbtqdN959Le/pWlPS3RLJ 7oXw3PBtP+WPJ1Nh6sTKtazoCX63VRTuwKseiU0SNteZ/asmf+dC3eW1P/jr2SERICvf N6DGk17NmmYPpHbOhAcM+FPNQNBzf5wjhExrJZ0NVhbzDkJYh4E+lx/LU7nfa8Gf7hUq teH0/6zUX+WP2Dz11lbjY0vMf954/spZTGVW8xxlsGNc8Ue1mfvyBbVZeQRQdcfIKwaU VI9QK0gQ2NITs24SJ9Ghgv4VnR4cYFkPQ0+dO4DTXkRXziVXYfD2HOIXYam50x2ccIjG Xqtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=hRCH07Tia6cSKL/uBOGB2Bx/SQECD88z/H8KGgvwwC8=; b=IuQuLWACcclTixLKvS8d7lwWUFfUh+9ZgLlT3j5cWPBJkNhMtnT22v0cVHGrVE0g6H jzkQVwdLAf5hqwKOklhxHGWgHBeuEp2ndQ3I+1Tpq0T9m3jkqvkIYrmC+pN7IrELWHLE 33SYjv7qCOm4tanKL+cnVIX9rbflqp8hjqfNauauAXfNHrtTnXD12JJNgeP0hDnn/1rH Fmthk53LEhoXpiF6fMHZemHSjEfK1nZePBnTbuWo8+5gLpylSX6UP0Vycz9S2hjlNebs 7+0KHHLq/P+oXCa+Suyi6VhRNdsroVuaSROSUHLgGtwnR6NeNDupqrqOeEN0hCGI1vKy xT8A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-acpi-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 87si13171051pfo.137.2018.04.25.17.27.43; Wed, 25 Apr 2018 17:27:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-acpi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751574AbeDZA1m (ORCPT + 8 others); Wed, 25 Apr 2018 20:27:42 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:45750 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751913AbeDZA0U (ORCPT ); Wed, 25 Apr 2018 20:26:20 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A001D16EA; Wed, 25 Apr 2018 17:26:19 -0700 (PDT) Received: from beelzebub.austin.arm.com (beelzebub.austin.arm.com [10.118.12.119]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 8D97F3F590; Wed, 25 Apr 2018 17:26:18 -0700 (PDT) From: Jeremy Linton To: linux-acpi@vger.kernel.org Cc: Sudeep.Holla@arm.com, linux-arm-kernel@lists.infradead.org, Lorenzo.Pieralisi@arm.com, hanjun.guo@linaro.org, rjw@rjwysocki.net, Will.Deacon@arm.com, Catalin.Marinas@arm.com, gregkh@linuxfoundation.org, Mark.Rutland@arm.com, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, wangxiongfeng2@huawei.com, vkilari@codeaurora.org, ahs3@redhat.com, Dietmar.Eggemann@arm.com, Morten.Rasmussen@arm.com, palmer@sifive.com, lenb@kernel.org, john.garry@huawei.com, austinwc@codeaurora.org, tnowicki@caviumnetworks.com, jhugo@qti.qualcomm.com, timur@qti.qualcomm.com, ard.biesheuvel@linaro.org, Jeremy Linton Subject: [PATCH v8 08/13] arm64: Add support for ACPI based firmware tables Date: Wed, 25 Apr 2018 18:31:16 -0500 Message-Id: <20180425233121.13270-9-jeremy.linton@arm.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180425233121.13270-1-jeremy.linton@arm.com> References: <20180425233121.13270-1-jeremy.linton@arm.com> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org The /sys cache entries should support ACPI/PPTT generated cache topology information. Lets detect ACPI systems and call an arch specific cache_setup_acpi() routine to update the hardware probed cache topology. For arm64, if ACPI is enabled, determine the max number of cache levels and populate them using the PPTT table if one is available. Signed-off-by: Jeremy Linton Reviewed-by: Sudeep Holla --- arch/arm64/kernel/cacheinfo.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) -- 2.13.6 -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/arm64/kernel/cacheinfo.c b/arch/arm64/kernel/cacheinfo.c index 380f2e2fbed5..0bf0a835122f 100644 --- a/arch/arm64/kernel/cacheinfo.c +++ b/arch/arm64/kernel/cacheinfo.c @@ -17,6 +17,7 @@ * along with this program. If not, see . */ +#include #include #include @@ -46,7 +47,7 @@ static void ci_leaf_init(struct cacheinfo *this_leaf, static int __init_cache_level(unsigned int cpu) { - unsigned int ctype, level, leaves, of_level; + unsigned int ctype, level, leaves, fw_level; struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu); for (level = 1, leaves = 0; level <= MAX_CACHE_LEVEL; level++) { @@ -59,15 +60,19 @@ static int __init_cache_level(unsigned int cpu) leaves += (ctype == CACHE_TYPE_SEPARATE) ? 2 : 1; } - of_level = of_find_last_cache_level(cpu); - if (level < of_level) { + if (acpi_disabled) + fw_level = of_find_last_cache_level(cpu); + else + fw_level = acpi_find_last_cache_level(cpu); + + if (level < fw_level) { /* * some external caches not specified in CLIDR_EL1 * the information may be available in the device tree * only unified external caches are considered here */ - leaves += (of_level - level); - level = of_level; + leaves += (fw_level - level); + level = fw_level; } this_cpu_ci->num_levels = level;